emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Redisplay slower in Emacs 28 than Emacs 27


From: Alan Third
Subject: Re: Redisplay slower in Emacs 28 than Emacs 27
Date: Mon, 7 Dec 2020 22:23:35 +0000

On Mon, Dec 07, 2020 at 10:59:24PM +0100, Lars Ingebrigtsen wrote:
> And this is the culprit -- i.e., this is what's busting the cache, as
> far as I can tell:
> 
> (defun tool-bar--image-expression (icon)
>   "Return an expression that evaluates to an image spec for ICON."
>   (let* ((fg (face-attribute 'tool-bar :foreground))
>        (bg (face-attribute 'tool-bar :background))
>        (colors (nconc (if (eq fg 'unspecified) nil (list :foreground fg))
>                       (if (eq bg 'unspecified) nil (list :background bg))))
>        (xpm-spec (list :type 'xpm :file (concat icon ".xpm")))
>        (xpm-lo-spec (list :type 'xpm :file
>                           (concat "low-color/" icon ".xpm")))
>        (pbm-spec (append (list :type 'pbm :file
>                                  (concat icon ".pbm")) colors))
>        (xbm-spec (append (list :type 'xbm :file
>                                  (concat icon ".xbm")) colors)))
>     `(find-image (cond ((not (display-color-p))
>                       ',(list pbm-spec xbm-spec xpm-lo-spec xpm-spec))
>                      ((< (display-color-cells) 256)
>                       ',(list xpm-lo-spec xpm-spec pbm-spec xbm-spec))
>                      (t
>                       ',(list xpm-spec pbm-spec xbm-spec))))))
> 
> Whenever Emacs is asked to redisplay the toolbar, Emacs will run this
> function?  That's what my instrumentation seems to say...
> 
> I don't use toolbars normally, so I'm not sure how they're supposed to
> work -- but shouldn't this toolbar data be computed only once, instead
> of repeatedly?

I think the image cache is actually broken.

If we have two image specs that have the same contents, but don't have
identical memory locations, surely we still want the cache to work?

For example when playing an animated gif image.el doesn't store the
image specs for each frame, it generates them on the fly by
incrementing the frame counter. I can see that Emacs creates a new
cache entry for every frame every time the gif is played through.

That means it must be decoding every frame every time.

-- 
Alan Third



reply via email to

[Prev in Thread] Current Thread [Next in Thread]