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 605666 - [performance] Speed up creation of instance GValue
[performance] Speed up creation of instance GValue
Status: RESOLVED DUPLICATE of bug 731950
Product: glib
Classification: Platform
Component: gobject
unspecified
Other All
: Normal enhancement
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2009-12-29 12:45 UTC by Edward Hervey
Modified: 2014-06-20 09:03 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gvalue: New g_value_make_instance method for creating/setting an instance (2.12 KB, patch)
2009-12-29 12:46 UTC, Edward Hervey
none Details | Review
gsignal: Use new g_value_make_instance method (1.40 KB, patch)
2009-12-29 12:46 UTC, Edward Hervey
none Details | Review
g_value_object_collect_value: Use faster argument checking. (1.46 KB, patch)
2009-12-29 12:46 UTC, Edward Hervey
none Details | Review

Description Edward Hervey 2009-12-29 12:45:43 UTC
Creating a GValue for an instance is used extensively during signal emission.

The following 3 patches speed up to 20% the emission of signals (g_signal_new_valist) by:
* using a new fast g_value_make_instance method which initializes a gvalue and sets the instance variable on it
* speeding up g_value_object_collect_value by avoiding unneeded extra checks
Comment 1 Edward Hervey 2009-12-29 12:46:13 UTC
Created attachment 150534 [details] [review]
gvalue: New g_value_make_instance method for creating/setting an instance

This avoids the overhead of separately calling g_value_init and
g_value_set_instance.
Comment 2 Edward Hervey 2009-12-29 12:46:17 UTC
Created attachment 150535 [details] [review]
gsignal: Use new g_value_make_instance method

Speeds up g_signal_emit_valist by another 15%
Comment 3 Edward Hervey 2009-12-29 12:46:22 UTC
Created attachment 150536 [details] [review]
g_value_object_collect_value: Use faster argument checking.

The argument were already checked in the caller of this function (g_value_set_pointer).
This makes the function 45% faster (based on valgrind instruction calls when
profiling usage by evolution (around 30000 calls).
Comment 4 Edward Hervey 2010-02-23 07:21:36 UTC
Any comments on this ? Would be nice for speeding up signal emission for 2.24
Comment 5 Benjamin Otte (Company) 2010-02-23 18:00:57 UTC
Can we use G_VALUE_COLLECT_INIT() here instead of introducing an internal _g_value_make_instance() function?

And I generally dislike patches that optimize around g_return_if_fail() and friends, but i have no solution to avoid those checks when we've done them before either.
Not sure how to best approach those cases...
Comment 6 Sebastian Dröge (slomo) 2010-06-12 10:10:22 UTC
Any news on this?
Comment 7 Alexander V. Butenko 2010-06-30 12:51:44 UTC
ping?
Comment 8 Edward Hervey 2010-06-30 13:23:49 UTC
Are you expecting an answer from me ? I don't see what's wrong with the patches.
Comment 9 Stefan Sauer (gstreamer, gtkdoc dev) 2011-03-26 13:35:05 UTC
(In reply to comment #8)
> Are you expecting an answer from me ? I don't see what's wrong with the
> patches.

Benjamin had one question in comment #5 for you.
Comment 10 Javier Jardón (IRC: jjardon) 2011-10-18 16:23:42 UTC
@Edward:

Could you reply to the question of comment #5 ?
Comment 11 Edward Hervey 2014-06-20 09:03:41 UTC
I actually figured out a way more effective/simple solution in bug #731950

*** This bug has been marked as a duplicate of bug 731950 ***