GNOME Bugzilla – Bug 426924
gtk_widget_get_draw_rectangle() very slow for big containers
Last modified: 2010-08-18 16:51:35 UTC
Calling gtk_widget_get_draw_rectangle() on containers that have a large number of children can be very slow. This is becase gtk_widget_get_draw_rectangle() recursively calls widget_add_child_draw_rectangle() on all its children. This is necessary for handling the 'draw-border' style property. When not using the 'draw-border' style property this is causing needless slowdown. Attached patch adds draw rectangle caching.
Created attachment 85902 [details] [review] Patch
The cached_rect needs to be released on style change... But otherwise it looks like a clean method of killing one of the most frequent style queries (and allocator!).
Created attachment 85942 [details] [review] New patch Clear draw rectangle on style change.
There is another bug where I proposed a caching mechanism for the draw rectangles. Maybe you can find it, and compare my patch ?
And also, a benchmark that shows performance benefits would be appreciated.
Created attachment 86170 [details] Simple benchmark
(In reply to comment #4) > There is another bug where I proposed a caching mechanism for the draw > rectangles. > Maybe you can find it, and compare my patch ? I looked for it, but couldn't find anything ..
bug 157805
Thanks. Your patch focuses on style properties, while mine prevents a container's complete widget tree from being walked on every draw, reducing the number of draw-border queries as an (intended) side effect.
What I dislike about this caching is that it adds an extra rectangle to every single no-window widget, even if there are no draw borders around at all. Can we arrange things to avoid that, e.g. by having a no-draw-border flag ? Another thing: at the places where you clear the cache (due to resizing or style change), don't you have to clear the caches up the hierarchy ?
Jorn, could you address the issues raised in comment #10? Is this bug still valid anyway?
Closing this bug report as no further information has been provided. Please feel free to reopen this bug if you can provide the information asked for. Thanks!
I'd like to keep this open, to consider dropping the draw-rectangle functionality in gtk3.
Created attachment 167602 [details] [review] remove draw-border support