[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: trunk r113947: * image.c: Fix animation cache signature memory leak.
From: |
Lars Magne Ingebrigtsen |
Subject: |
Re: trunk r113947: * image.c: Fix animation cache signature memory leak. |
Date: |
Mon, 19 Aug 2013 22:55:33 +0200 |
User-agent: |
Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3.50 (gnu/linux) |
I think what might really help with the speed is doing more caching and
a better liveliness analysis. Or something.
First of all, every iteration we re-parse the "super-wand":
if (filename)
status = MagickReadImage (image_wand, filename);
else
{
filename_hint = imagemagick_filename_hint (img->spec, hint_buffer);
MagickSetFilename (image_wand, filename_hint);
status = MagickReadImageBlob (image_wand, contents, size);
}
If we stash that in the cache, too, then my guess would be that we'd see
a rather large speed-up. We'd have to have a way to compute an ID for
the data, though. I'd suggest just doing a sha256 or something over
contents and then perhaps using the same animation cache. It'd need
some tweaks, though, because we don't want to cache non-animation
images, and we don't know whether they are or not before we've parsed
it. :-)
The other thing is that imagemagick_compute_animated_image clones the
wand before putting it into the cache:
cache->wand = CloneMagickWand (composite_wand)
This is because imagemagick_load_image later destroys the wand, so we
need a copy. This could be avoided, of course, and my guess is that
this would also be a nice speed-up, because copying a wand must probably
entail copying the entire data.
If you could look at this, I think the ImageMagick animation could start
approaching the gif animation code speed-wise. At present, it's much
slower, especially on large images.
This is the code snippet I use to test:
(url-retrieve "http://cdn.arwrath.com/1/148330.gif"
(lambda (&rest ignore)
(search-forward "\n\n")
(let ((image (create-image
(buffer-substring (point) (point-max))
'imagemagick t)))
(pop-to-buffer "*image*")
(erase-buffer)
(delete-all-overlays)
(put-image image (point) "*")
(image-animate image nil 60))))
--
(domestic pets only, the antidote for overdose, milk.)
No Gnus T-Shirt for sale: http://ingebrigtsen.no/no.php
and http://lars.ingebrigtsen.no/2013/08/twenty-years-of-september.html
- Re: trunk r113947: * image.c: Fix animation cache signature memory leak., (continued)
- Re: trunk r113947: * image.c: Fix animation cache signature memory leak., Paul Eggert, 2013/08/19
- Re: trunk r113947: * image.c: Fix animation cache signature memory leak., Lars Magne Ingebrigtsen, 2013/08/19
- Re: trunk r113947: * image.c: Fix animation cache signature memory leak., Paul Eggert, 2013/08/19
- Re: trunk r113947: * image.c: Fix animation cache signature memory leak., Lars Magne Ingebrigtsen, 2013/08/19
- Re: trunk r113947: * image.c: Fix animation cache signature memory leak., Paul Eggert, 2013/08/19
- Re: trunk r113947: * image.c: Fix animation cache signature memory leak., Lars Magne Ingebrigtsen, 2013/08/19
- Re: trunk r113947: * image.c: Fix animation cache signature memory leak., Paul Eggert, 2013/08/19
- Re: trunk r113947: * image.c: Fix animation cache signature memory leak., Lars Magne Ingebrigtsen, 2013/08/19
- Re: trunk r113947: * image.c: Fix animation cache signature memory leak., Paul Eggert, 2013/08/19
- Re: trunk r113947: * image.c: Fix animation cache signature memory leak., Lars Magne Ingebrigtsen, 2013/08/19
- Re: trunk r113947: * image.c: Fix animation cache signature memory leak.,
Lars Magne Ingebrigtsen <=