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 679978 - [PATCH] Optimize gtk_widget_path_copy() by preallocating "elems" array
[PATCH] Optimize gtk_widget_path_copy() by preallocating "elems" array
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
3.4.x
Other All
: Normal enhancement
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2012-07-16 00:05 UTC by John Lindgren
Modified: 2012-08-07 04:39 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Preallocate "elems" array (657 bytes, patch)
2012-07-16 00:05 UTC, John Lindgren
accepted-commit_now Details | Review

Description John Lindgren 2012-07-16 00:05:31 UTC
Created attachment 218869 [details] [review]
Preallocate "elems" array

Using GTK+ 3.4.3 here.

gtk_widget_path_copy() currently calls g_array_append_val() in a loop, which is inefficient due to reallocating the array's memory.  Calling g_array_set_size() before entering the loop reduces the number of CPU cycles used by roughly 30% in my testing.