GNOME Bugzilla – Bug 605666
[performance] Speed up creation of instance GValue
Last modified: 2014-06-20 09:03:41 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
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.
Created attachment 150535 [details] [review] gsignal: Use new g_value_make_instance method Speeds up g_signal_emit_valist by another 15%
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).
Any comments on this ? Would be nice for speeding up signal emission for 2.24
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...
Any news on this?
ping?
Are you expecting an answer from me ? I don't see what's wrong with the patches.
(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.
@Edward: Could you reply to the question of comment #5 ?
I actually figured out a way more effective/simple solution in bug #731950 *** This bug has been marked as a duplicate of bug 731950 ***