GNU bug report logs - #77961
31.0.50; Rendering HTML email is very slow since commit #eab14d68b2e72b9a6b8b0cc67c9667c2bfbed4f5

Previous Next

Package: emacs;

Reported by: Iñigo Serna <inigoserna <at> gmx.com>

Date: Mon, 21 Apr 2025 15:58:02 UTC

Severity: normal

Found in version 31.0.50

Fixed in version 31.1

Done: Gerd Möllmann <gerd.moellmann <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Gerd Möllmann <gerd.moellmann <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: yantar92 <at> posteo.net, inigoserna <at> gmx.com, 77961 <at> debbugs.gnu.org
Subject: bug#77961: 31.0.50; Rendering HTML email is very slow since commit #eab14d68b2e72b9a6b8b0cc67c9667c2bfbed4f5
Date: Tue, 22 Apr 2025 15:04:59 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Gerd Möllmann <gerd.moellmann <at> gmail.com>
>> Cc: Iñigo Serna <inigoserna <at> gmx.com>,  Eli Zaretskii
>>  <eliz <at> gnu.org>,
>>   77961 <at> debbugs.gnu.org
>> Date: Tue, 22 Apr 2025 10:02:58 +0200
>> 
>> Could you please also check with this diff?
>> 
>> diff --git a/src/dispnew.c b/src/dispnew.c
>> index 24bf975ef9f..40df078aea6 100644
>> --- a/src/dispnew.c
>> +++ b/src/dispnew.c
>> @@ -504,13 +504,16 @@ adjust_glyph_matrix (struct window *w, struct glyph_matrix *matrix, int x, int y
>>  
>>  	  while (row < end)
>>  	    {
>> -	      row->glyphs[LEFT_MARGIN_AREA]
>> -		= xnrealloc (row->glyphs[LEFT_MARGIN_AREA],
>> -			     dim.width, sizeof (struct glyph));
>> -	      /* We actually need to clear only the 'frame' member, but
>> -                 it's easier to clear everything.  */
>> -	      memset (row->glyphs[LEFT_MARGIN_AREA], 0,
>> -		      dim.width * sizeof (struct glyph));
>> +	      if (dim.width > matrix->matrix_w || new_rows)
>> +		{
>> +		  row->glyphs[LEFT_MARGIN_AREA]
>> +		    = xnrealloc (row->glyphs[LEFT_MARGIN_AREA],
>> +				 dim.width, sizeof (struct glyph));
>> +		  /* We actually need to clear only the 'frame' member, but
>> +		     it's easier to clear everything.  */
>> +		  memset (row->glyphs[LEFT_MARGIN_AREA], 0,
>> +			  dim.width * sizeof (struct glyph));
>> +		}
>
> This means a very large matrix will not be downsized when possible.
> Is that a good idea?  Maybe try replacing '>' with '!=' and see if it
> also solves the problem?

It's at least what I originally intended when I wrote that function. On
the grounds that if it grew to some size once, it woiuld likely again to
that size again. Compare the allocation of the row vector where I did
the same, for the same reason.

dispnew.c:
  416   /* Enlarge MATRIX->rows if necessary.  New rows are cleared.  */
  417   if (matrix->rows_allocated < dim.height)
  418     {
  419       int old_alloc = matrix->rows_allocated;
  420       new_rows = dim.height - matrix->rows_allocated;
  421       matrix->rows = xpalloc (matrix->rows, &matrix->rows_allocated,
  422                               new_rows, INT_MAX, sizeof *matrix->rows);
  423       memset (matrix->rows + old_alloc, 0,
  424               (matrix->rows_allocated - old_alloc)
  425                 * sizeof *matrix->rows);
  426     }
  427   else
  428     new_rows = 0;




This bug report was last modified 27 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.