GNU bug report logs - #61394
30.0.50; [PATCH] Image-dired thumb name based on content

Previous Next

Package: emacs;

Reported by: Manuel Giraud <manuel <at> ledu-giraud.fr>

Date: Thu, 9 Feb 2023 19:08:02 UTC

Severity: normal

Tags: patch

Found in version 30.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Manuel Giraud <manuel <at> ledu-giraud.fr>
Cc: contovob <at> tcd.ie, 61394 <at> debbugs.gnu.org
Subject: bug#61394: 30.0.50; [PATCH] Image-dired thumb name based on content
Date: Sat, 11 Feb 2023 16:53:25 +0200
> From: Manuel Giraud <manuel <at> ledu-giraud.fr>
> Cc: contovob <at> tcd.ie,  61394 <at> debbugs.gnu.org
> Date: Sat, 11 Feb 2023 13:30:48 +0100
> 
> > Btw, using only the first 4KiB would mean a collision is still
> > possible, albeit rarely, right?  So your use case of having all the
> > thumbnails in the same directory could sometimes fail, right?
> 
> The 4KiB was "quite large but not so much" guess.  I've made tests with
> the following code:
> 
> --8<---------------cut here---------------start------------->8---
> (defun sha1-test (filename size)
>   (with-temp-buffer
>     (insert-file-contents-literally filename nil 0 size)
>     (sha1 (current-buffer))))
> 
> ;; From 1KiB to 64KiB
> (list
>  (benchmark-run-compiled 1000
>    (sha1-test "/tmp/a-5MiB-photo.jpg" (expt 2 10)))
>  (benchmark-run-compiled 1000
>    (sha1-test "/tmp/a-5MiB-photo.jpg" (expt 2 11)))
>  (benchmark-run-compiled 1000
>    (sha1-test "/tmp/a-5MiB-photo.jpg" (expt 2 12)))
>  (benchmark-run-compiled 1000
>    (sha1-test "/tmp/a-5MiB-photo.jpg" (expt 2 13)))
>  (benchmark-run-compiled 1000
>    (sha1-test "/tmp/a-5MiB-photo.jpg" (expt 2 14)))
>  (benchmark-run-compiled 1000
>    (sha1-test "/tmp/a-5MiB-photo.jpg" (expt 2 15)))
>  (benchmark-run-compiled 1000
>    (sha1-test "/tmp/a-5MiB-photo.jpg" (expt 2 16))))
> --8<---------------cut here---------------end--------------->8---
> 
> And here are the results on my machine:
> ((0.664336771 1 0.14466495299998883)
>  (0.707937024 2 0.28811983400001395)
>  (0.940229304 3 0.44037704100000497) ;; <- 4KiB
>  (1.672118528 4 0.7672738199999856)
>  (2.6194289370000003 6 1.046699996000001)
>  (3.169999951 11 1.5916382949999957)
>  (6.547043287 21 3.195145416999992))
> 
> So this 4KiB seems practical: about 1 second for one thousand run.
> WDYT?

I only commented on that because you said it allows you to use a
single directory.  Otherwise, I have no problems with using just 4KiB.




This bug report was last modified 1 year and 290 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.