Subject: bug#47895: 28.0.50; Emacs should only animate images that are visible

From: Lars Ingebrigtsen <[email-masked]>
Date: Mon, 03 May 2021 11:52:52 +0200

Eli Zaretskii <[email-masked]> writes:

> Because image-animate-timeout calls image-metadata (via
> image-multi-frame-p), which calls lookup_image, which regenerates the
> pixmap.

Aah!  Thanks; image.el doesn't have to keep calling that function -- it
can just call it once and then stash the data in the image plist.

I've now done that change on the trunk, and my test case went from using
100% CPU to using 7% CPU, which is an improvement.  :-)

Virtually all of the remaining CPU usage comes from the call to
`force-window-update' -- and I guess that shouldn't be called if the
buffer isn't displayed in a window.  Let's see...

Yup, with that change, the CPU usage went down to 2%.

So I think that this problem is now fixed, and I'm closing this bug report.

> But no repetitions were actually displayed yet, so won't this be
> confusing?  Shouldn't we start counting only when the image is
> actually visible?

I don't really have an opinion here -- but the image animation code
hasn't taken this into consideration before, so that would be a change
in behaviour.  

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no