GNOME Bugzilla – Bug 692605
[PATCH] Optimize gdk_x11_screen_get_setting()
Last modified: 2013-01-27 00:08:55 UTC
In profiling the startup time of Audacious, I found that the current implementation gdk_x11_screen_get_setting() is inefficient because it does two linear searches using strcmp(), first to translate the GTK+ property name to the corresponding XSETTINGS name and then to look up that name in the XSettingsList. gdk_x11_screen_get_setting() is called about 960 times during startup and ends up making about 64,000 calls to strcmp(). Valgrind claims that this amounts to about 3,900,000 CPU cycles. By using hash table lookups instead, the cost can be reduced to about 1,200,000 cycles.
Created attachment 234500 [details] [review] Second patch
Created attachment 234501 [details] [review] First patch