[Xfce-bugs] review granted: [Bug 11817] Slow startup when a folder with many wallpapers is selected : [Attachment 6239] Slightly improved git patch

bugzilla-daemon at xfce.org bugzilla-daemon at xfce.org
Mon May 11 10:52:49 CEST 2015


Igor Kushnir <igorkuo at meta.ua> has granted  review:
Bug 11817: Slow startup when a folder with many wallpapers is selected
https://bugzilla.xfce.org/show_bug.cgi?id=11817

Attachment 6239: Slightly improved git patch
https://bugzilla.xfce.org/attachment.cgi?id=6239&action=edit



--- Comment #4 from Igor Kushnir <igorkuo at meta.ua> ---
Created attachment 6239
  --> https://bugzilla.xfce.org/attachment.cgi?id=6239&action=edit
Slightly improved git patch

Improved my patch (added a comment; small optimization for 0 or 1 image list
size) and formatted it with git.

I profiled xfdesktop with callgrind/KCachegrind and found that
compare_by_collate_key is very slow. When I replaced it with strcmp, both
g_list_sort and sort_image_list implementations started in 0.5s with 6192
images. When I completely disabled sorting, the starting time was also 0.5s, so
it is only sorting with compare_by_collate_key that is slow.
xfdesktop can be further optimized for the Random Order case, when sorting is
not useful. For random wallpaper order you could store images in an unsorted
array instead of a sorted list. This way not only the sorting overhead would be
eliminated, but also O(1) random access would be possible (currently the O(N)
random list access is used when choosing the next random image). If you don't
want to complicate the code with the array, you could at least sort the list
only when Random Order option is/gets disabled.

I also profiled xfdesktop-settings, but didn't find anything useful. Maybe it's
because of the asynchronous loading of images.
http://s10.postimg.org/m6ucayj61/xfdesktop_settings_KCachegrind_screenshot.png


More information about the Xfce-bugs mailing list