BestImageViewer / geeqie

claiming to be the best image viewer / photo collection browser
http://www.geeqie.org/
GNU General Public License v2.0
471 stars 77 forks source link

Better thumb loading logic #1232

Open installgentoo opened 8 months ago

installgentoo commented 8 months ago

Setup (please complete the following information):

Describe your feature request Load thumbs around where user is looking.

Additional context Right now, after loading all the thumbs in the view, geeqie loads all the thumbs in directory(which eventually causes OOM for me on 200k+ files), starting from the very top of filelist, whenever you enter a directory. This is redundant and slows everything down. Instead, geeqie should look at where the first thumb in the fileview, and load N thumbs before and after it. This would make memory behaviour bounded at some sane default, and speed up thumb loading, since if you're never gonna navigate to the top specifically, you'll navigate around where you currently are.

ppayne commented 6 months ago

Summary: load/render the desired image first, scan directory later.

Detail: This is perhaps the number 1 reason why I would seek another image viewer.

I often want to browse an image in a directory on a network share that contains hundreds of photos. I do not want to wait for a thumbnail of every single photo to be processed before the image I clicked on is displayed.

The viewer should, ideally, load and render the desired image first - before any directory scanning whatsoever. Only after the image desired is displayed should the viewer then perform any background activity such as directory scanning (ideally in another thread).

The first scan of the directory should be using operations such as readdir() that simply retrieve filenames. This is a super quick operation even on a network share over a WAN. Only after the first pass should individual file attributes (such as size, last modify time) be sought and/or data loaded (for thumbnail generation purposes).

caclark commented 6 months ago

If you select Images as List mode and make sure that Show Thumbnails is not selected, there should be no delay.

That is not a solution to the problem.

Unfortunately I until recently I have not taken this problem too seriously because it does not affect me. I will do what I can.

xsdg commented 6 months ago

@ppayne Another relevant challenge that I know Colin has mentioned in the past is that if a sort order is selected that requires Geeqie to stat every file (basically, anything other than "Sort by name"), then Geeqie isn't going to have much ability to avoid stat'ing every file. It's possible that there could be better documentation (or some sort of in-app hint) about this, but from an actual implementation perspective, I'm at least not seeing much better options outside of "Sort by name".

Note that if Geeqie stats every file in "Sort by name" mode, that's something that could potentially be optimized (I don't know whether or not it does)

ppayne commented 6 months ago

@caclark many thanks, turning off thumbnails in the file list view now makes viewing an image in a directory with many images much, much faster. I am going to use it this way going forward.

caclark commented 6 months ago

I will put this comment here to remind myself to update the FAQ or Hints in the documentation.

If you regularly want to sort on Exif time (DateTimeOriginal or DateTimeDigitized), the metadata has to be read from all the files before the directory can be sorted. If on import from the camera (via script or plugin or whatever) you set the file datetime to the exif time, and sort on file datetime sorting will be much faster.

[There is also the option Edit/Preferences/Metadata/Read Metadata In Background]

ppayne commented 6 months ago

My issue is that the directory seems to be read before the selected image is rendered. I'd like the image to be rendered first, then directory reading afterwards (ideally in a separate thread in the background).

caclark commented 6 months ago

@ppayne Which thumbnail caching option do you use?