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 692605 - [PATCH] Optimize gdk_x11_screen_get_setting()
[PATCH] Optimize gdk_x11_screen_get_setting()
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: X11
3.6.x
Other Linux
: Normal enhancement
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2013-01-26 22:29 UTC by John Lindgren
Modified: 2013-01-27 00:08 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Second patch (8.18 KB, patch)
2013-01-26 22:29 UTC, John Lindgren
committed Details | Review
First patch (12.38 KB, patch)
2013-01-26 22:30 UTC, John Lindgren
committed Details | Review

Description John Lindgren 2013-01-26 22:29:19 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.
Comment 1 John Lindgren 2013-01-26 22:29:56 UTC
Created attachment 234500 [details] [review]
Second patch
Comment 2 John Lindgren 2013-01-26 22:30:28 UTC
Created attachment 234501 [details] [review]
First patch