From: Lars Ingebrigtsen Date: Wed, 9 Dec 2020 00:10:04 +0000 (+0100) Subject: Make uncache_image slightly more efficient X-Git-Tag: emacs-28.0.90~4840 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=85acde2ab5c2327c8f70ea3c284f26de4a44128b;p=emacs.git Make uncache_image slightly more efficient * src/image.c (uncache_image): Extremely minor speed-up: Only compute the hash once. --- diff --git a/src/image.c b/src/image.c index 846f2d1a5b3..522a4cf7c0f 100644 --- a/src/image.c +++ b/src/image.c @@ -1633,12 +1633,13 @@ static void uncache_image (struct frame *f, Lisp_Object spec) { struct image *img; + EMACS_UINT hash = sxhash (spec); /* Because the background colors are based on the current face, we can have multiple copies of an image with the same spec. We want to remove them all to ensure the user doesn't see an old version of the image when the face changes. */ - while ((img = search_image_cache (f, spec, sxhash (spec), 0, 0, true))) + while ((img = search_image_cache (f, spec, hash, 0, 0, true))) { free_image (f, img); /* As display glyphs may still be referring to the image ID, we