GNU bug report logs -
#68006
30.0.50; Image-mode speed
Previous Next
Full log
Message #44 received at 68006 <at> debbugs.gnu.org (full text, mbox):
> From: Manuel Giraud <manuel <at> ledu-giraud.fr>
> Cc: 68006 <at> debbugs.gnu.org
> Date: Fri, 29 Dec 2023 12:11:44 +0100
>
> What about this new patch? It works for me as intended but might need
> better names and better docs. Thanks.
>
> +(defcustom image-mode-eager-cache-flush t
> + "Non-nil means flush image from cache eagerly.
> +When set to nil, be aware that the image cache could grow fast
> +but an image previously displayed will show faster."
This doc string should explain the effects better, in terms of
user-facing behavior, not in terms of technical aspects of the code.
> - ;; Discard any stale image data before looking it up again.
> - (image-flush image)
> + (if image-mode-eager-cache-flush
> + ;; Discard any stale image data before looking it up again.
> + (image-flush image)
> + ;; Add a content based hash into image spec to be sure that the
> + ;; cache is updated should the on disk image change.
> + (when (and filename (file-exists-p filename))
> + (setq image (append image (list :hash (image-contents-sha1 filename))))))
> +
I'm probably missing something: how would this assure that if the
image file is replaced, we re-read it from disk?
> +(defun image-contents-sha1 (filename)
> + "Compute the SHA-1 of the first 4KiB of FILENAME's contents. The
> +first 4KiB does not represent the whole file but was chosen
> +because it is fast enough for interactive usage."
The first line of a doc string should be a single complete sentence.
Thanks.
This bug report was last modified 224 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.