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 704077 - StWidget: use a handler id to disconnect the callback
StWidget: use a handler id to disconnect the callback
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
: 704799 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2013-07-12 09:55 UTC by Emilio Pozuelo Monfort
Modified: 2013-08-19 20:43 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
StWidget: use a handler id to disconnect the callback (2.06 KB, patch)
2013-07-12 09:55 UTC, Emilio Pozuelo Monfort
committed Details | Review

Description Emilio Pozuelo Monfort 2013-07-12 09:55:36 UTC
This should make widget destruction a little bit faster. We have seen
some freezes when destroying a big amount of widgets and this seemed
to be one of the bottlenecks. Some further optimizations may be needed
but this trivial change is simple and correct and will help a bit.
Comment 1 Emilio Pozuelo Monfort 2013-07-12 09:55:40 UTC
Created attachment 248993 [details] [review]
StWidget: use a handler id to disconnect the callback

g_signal_handlers_disconnect_by_func() is much more expensive
than g_signal_handler_disconnect(), so use the latter.
Comment 2 Giovanni Campagna 2013-07-12 11:16:32 UTC
Review of attachment 248993 [details] [review]:

Looks good
Comment 3 Emilio Pozuelo Monfort 2013-07-12 11:40:10 UTC
Comment on attachment 248993 [details] [review]
StWidget: use a handler id to disconnect the callback

Pushed as c9b079c
Comment 4 Jasper St. Pierre (not reading bugmail) 2013-07-12 16:36:51 UTC
It's not more expensive at all. They both require a linear search over the list of handlers.
Comment 5 Allison Karlitskaya (desrt) 2013-07-12 16:40:28 UTC
The only difference is that disconnecting by id can stop once it has found the id.  If things are randomly distributed, I'd say it's exactly twice as fast.
Comment 6 Emilio Pozuelo Monfort 2013-07-13 16:06:21 UTC
(In reply to comment #5)
> The only difference is that disconnecting by id can stop once it has found the
> id.  If things are randomly distributed, I'd say it's exactly twice as fast.

That, plus we only do the lookup (iterating through the signal handler structures) once instead of every time dispose gets called.
Comment 7 Giovanni Campagna 2013-08-16 20:36:10 UTC
*** Bug 704799 has been marked as a duplicate of this bug. ***
Comment 8 nikita.vetoshkin 2013-08-16 20:48:23 UTC
Is it going to be backported to 3.8? (which is used in current Fedora 19)
Comment 9 Jasper St. Pierre (not reading bugmail) 2013-08-16 20:50:36 UTC
I don't think it matters too much. The savings here are extremely minimal.
Comment 10 nikita.vetoshkin 2013-08-16 20:52:38 UTC
It's just it's killing gnome experience completely - desktop freezes for a minute once an hour in my case.
Comment 11 Jasper St. Pierre (not reading bugmail) 2013-08-16 20:54:58 UTC
This should not be freezing your desktop for a minute. I bet when you captured your trace it was just one of the many things getting destroyed. Can you try and capture the what was taking the most time with `perf top` when the freeze happens?
Comment 12 nikita.vetoshkin 2013-08-16 20:57:46 UTC
Yeah, sure. That should be easy.
Comment 13 nikita.vetoshkin 2013-08-19 20:43:07 UTC
Installed perf and debuginfo for libgobject. During freeze I see this:
66.82% libgobject-2.0.so.0.3600.3 handlers_find