After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 495825 - Slow startup when launched for viewing an image located in a crowded directory
Slow startup when launched for viewing an image located in a crowded directory
Status: RESOLVED OBSOLETE
Product: eog
Classification: Core
Component: general
git master
Other Linux
: Normal enhancement
: ---
Assigned To: EOG Maintainers
EOG Maintainers
: 500772 512318 514971 517032 521473 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2007-11-11 10:23 UTC by Emmanuel Pacaud
Modified: 2021-06-19 08:46 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
disable sorting while adding a directory (571 bytes, patch)
2008-01-25 17:56 UTC, Felix Riemann
committed Details | Review

Description Emmanuel Pacaud 2007-11-11 10:23:33 UTC
If you launch eog for viewing an image which is located in a directory full of images (5000), eog startup is too long (20 s).

It probably scans for all files before showing anything. I think it would be nice if it could first display the requested image, then do the scan in an idle loop.
Comment 1 Lucas Rocha 2007-11-12 21:49:14 UTC
Emmanuel, which version of EOG are you using? This is most likely fixed in 2.20.x. 
Comment 2 Emmanuel Pacaud 2007-11-13 07:16:57 UTC
It's eog 2.20.1.
Comment 3 Felix Riemann 2008-01-25 17:56:39 UTC
Created attachment 103741 [details] [review]
disable sorting while adding a directory
Comment 4 Felix Riemann 2008-01-25 17:58:26 UTC
Hmm, somehow the comment got lost for the attachment.

So, could you give this one a try?
It disables the sorting for the model while adding a directory to avoid constant resorting.
I guess this is what was originally intended here anyway.
Comment 5 Claudio Saavedra 2008-01-28 20:45:08 UTC
*** Bug 512318 has been marked as a duplicate of this bug. ***
Comment 6 Claudio Saavedra 2008-02-07 13:38:26 UTC
*** Bug 514971 has been marked as a duplicate of this bug. ***
Comment 7 Claudio Saavedra 2008-02-07 14:49:46 UTC
I ran eog in a cairo/tests directory with about 5000 images.

According to sysprof, about 67% of the time is spent on sorting. 

After having applied your patch, the directory loads much faster and less CPU usage is consumed (your optimization was obviously needed, I wonder why I didn't add it from the beginning).

After the patch, the left bottlenecks are:

- Detection of the mimetypes: 30%
- gtk_recent_manager_init:    20%

So, Felix, please go on and commit your patch.

Regarding the detection of the mimetypes, it makes sense to display the requested image and only check for every image's mimetype if the thumbpane is visible, otherwise, do it in a idle callback. I would love to work on this, but I don't think I'll have time before 2.22.
Comment 8 Felix Riemann 2008-02-08 13:02:35 UTC
Committed.

2008-02-08  Felix Riemann  <>

	* src/eog-list-store.c: (eog_list_store_add_uris):
	Disable sorting while adding a directory to the collection.
	This should improve the startup time in huge directories.
	Improves bug #495825.
Comment 9 Christophe Jouny 2008-02-22 21:25:54 UTC
I am the poster of bug reported on Gentoo (here as Bug 514971)

I tested the patch proposed here on Gentoo 64bits; AMD X2 4200+; eog-2.20.4.

My case might be extreme (15k images), but this patch does not bring the opening of eog to a reasonable speed. I interrupted the process after 1 minute.

For comparison "gqview one_file.jpg" on same folder open in less than 2 seconds.

Comment 10 Felix Riemann 2008-02-25 00:07:31 UTC
Christophe, your problem now are probably the "30% mime detection" Claudio mentioned. As we force mime sniffing during the model creation every file has to be opened and a sample needs to be taken. This is taking some time, especially with 15000 images.

I'm not sure but GQView is I think only doing some filename matching to determine if a file is supported or not (which is of course faster).

Hmm, could be worth a try checking if "normal" mime checking is sufficient for EOG during the model creation as well.
Comment 11 Christophe Jouny 2008-02-25 16:46:43 UTC
Even if my extreme case is not supported by eog (which I can somewhat understand), the lack of feedback during the "opening" gives the impression that either the program has crashed or worst froze the computer as it takes 100% CPU.

There should be a way to regain control - short of using pkill. A kind of "cancel" button while opening.

Comment 12 Claudio Saavedra 2008-02-25 17:07:01 UTC
I'll be working on improving EOG's startup time and responsiveness, but unfortunately, not now. I happen to be quite busy at the moment, so I'll probably look deeply into this during the next cycle.
Comment 13 Felix Riemann 2008-03-10 10:39:44 UTC
*** Bug 521473 has been marked as a duplicate of this bug. ***
Comment 14 Felix Riemann 2008-03-10 11:03:21 UTC
(In reply to comment #10)
> 
> Hmm, could be worth a try checking if "normal" mime checking is sufficient for
> EOG during the model creation as well.
> 

FYI, we will probably have to do this anyway once the remaining parts of the GIO patch (bug 509239) are being merged. GIO doesn't have a way to force mime-sniffing. This means we need to do the sniffing ourselves (as we need the precise mimetype for the initial loader selection), which I would postpone until we are actually loading the image when we are reading the file anyway.

Comment 15 Andreas Moog 2008-09-06 23:23:11 UTC
Hi! Could you give a status-update on this issue? Thanks.
Comment 16 Emmanuel Pacaud 2008-09-08 12:44:15 UTC
Hi.

eog .

in a local directory with more than 16000 tiny images (250 MB) opens in 5 seconds. Which is fine for me.

I still think it would be even greater if eog could display immediatly the requested image, then parse the directory for the other images (ideally in an asynchronous way http://log.ometer.com/2008-09.html#7 :) ).

Thanks for your work !

    Emmanuel.
Comment 17 Felix Riemann 2008-09-17 07:47:49 UTC
(In reply to comment #15)
> Hi! Could you give a status-update on this issue? Thanks.
> 

Well, the situation should be a bit improved with 2.23/2.24 for now as these versions don't forcibly do mime sniffing due to GIO (see my comment 14) and we didn't get around to try implementing it ourselves.

Asynchronically parsing the directory (as proposed by Emmanuel, IIRC this was proposed somewhere else already as well) showed some potential in a quick test but it will also need some time to fix threading and path lifetime issues with the ListStore.
Comment 18 Pavel Šefránek 2011-07-03 16:18:43 UTC
*** Bug 500772 has been marked as a duplicate of this bug. ***
Comment 19 Pavel Šefránek 2011-07-03 16:19:11 UTC
*** Bug 517032 has been marked as a duplicate of this bug. ***
Comment 20 Jerome 2011-11-06 17:52:11 UTC
Does eog "display" the next image into memory before actually displaying the image by performing a simple copy of the buffer to the video memory ?
Comment 21 André Klapper 2021-06-19 08:46:06 UTC
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org.
As part of that, we are mass-closing older open tickets in bugzilla.gnome.org
which have not seen updates for a longer time (resources are unfortunately
quite limited so not every ticket can get handled).

If you can still reproduce the situation described in this ticket in a recent
and supported software version, then please follow
  https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines
and create a new ticket at
  https://gitlab.gnome.org/GNOME/eog/-/issues/

Thank you for your understanding and your help.