GNOME Bugzilla – Bug 704077
StWidget: use a handler id to disconnect the callback
Last modified: 2013-08-19 20:43:07 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.
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.
Review of attachment 248993 [details] [review]: Looks good
Comment on attachment 248993 [details] [review] StWidget: use a handler id to disconnect the callback Pushed as c9b079c
It's not more expensive at all. They both require a linear search over the list of handlers.
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.
(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.
*** Bug 704799 has been marked as a duplicate of this bug. ***
Is it going to be backported to 3.8? (which is used in current Fedora 19)
I don't think it matters too much. The savings here are extremely minimal.
It's just it's killing gnome experience completely - desktop freezes for a minute once an hour in my case.
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?
Yeah, sure. That should be easy.
Installed perf and debuginfo for libgobject. During freeze I see this: 66.82% libgobject-2.0.so.0.3600.3 handlers_find