GNOME Bugzilla – Bug 505811
slow image switching due to GtkRecent
Last modified: 2008-01-06 00:18:29 UTC
Doing some research on why eog takes so long on image switching, I discovered that most of the lapse after the image is loaded and before is shown is consumed by calls to GtkRecent code. Not sure if this operation should be slow at all, but my naive approach on making EOG more responsive is not to add the image to the recent manager immediately, but by means of a g_idle_add call. The results, in my Celeron 1.4 GHz, are really cool. Further investigation showed that there is also some considerable time wasted during the initialization of eog. Not quite sure if using the same technique makes any difference, as I can't really notice it. I attach some sysprof graphs and a proposed patch that makes eog more smooth during image switching and (perhaps?) during the initial launch.
Created attachment 101649 [details] sysprof output for image loading times
Created attachment 101650 [details] sysprof output during EogWindow's construction
Created attachment 101651 [details] [review] use g_idle_add to add the loaded image to the recent files
Of course, there's always the posibility that we are doing something wrong with the GtkRecent code, or that there's room for optimization inside of it.
One "problem" GtkRecent currently has is that the bookmark file is not (automatically) cleaned up. So, after some time this file is quite big and needs longer and longer to parse (which is done on initialisation and I think on changes as well).
Anything we can do on the application side to clean it up? Felix, are you OK with the patch?
I committed this patch with a minor modification: using G_PRIORITY_LOW, so high quality image rendering has more priority than this, and therefore images are rendered in HQ without an extra lag. (Trunk, rev 4293). 2008-01-05 Claudio Saavedra <csaavedra@alumnos.utalca.cl> * src/eog-window.c: (add_uri_to_recent_files), (eog_window_display_image): Add the URI to recent files in a low priority idle function, making images display faster. Fixes bug #505811.