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 751082 - GtkTreeView draw performance is bad when contents are not larger than allocation
GtkTreeView draw performance is bad when contents are not larger than allocation
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkTreeView
3.17.x
Other Linux
: Normal normal
: ---
Assigned To: gtktreeview-bugs
gtktreeview-bugs
Depends on:
Blocks:
 
 
Reported: 2015-06-16 23:56 UTC by Christian Hergert
Modified: 2015-08-20 18:15 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
allow widgets to require pixelcaching (5.84 KB, patch)
2015-06-16 23:57 UTC, Christian Hergert
committed Details | Review
pixelcache treeview contents when a model is set (1.01 KB, patch)
2015-06-16 23:58 UTC, Christian Hergert
committed Details | Review

Description Christian Hergert 2015-06-16 23:56:25 UTC
Another performance "issue" found from animated sequences in Builder when a GtkTreeView is in play.

Despite not changing the allocation at all, GtkTreeView still goes through a lot of full redraws of the bin window. This is happening because often times the treeview is not larger than the widget allocation. This causes pixelcache to not pixelcache the contents (since it was primarily aimed at scrolling performance) and results in jittery drawing.

Two patches provided:

 1) allow a widget to always require that pixelcache cache drawing contents.
 2) Teach GtkTreeView to always pixel cache when a model is attached.

This makes a few animated sequences in Builder very smooth, finally!
Comment 1 Christian Hergert 2015-06-16 23:57:22 UTC
Created attachment 305439 [details] [review]
allow widgets to require pixelcaching

This lets a widget using GtkPixelCache to require the pixelcache always cache window contents.
Comment 2 Christian Hergert 2015-06-16 23:58:04 UTC
Created attachment 305440 [details] [review]
pixelcache treeview contents when a model is set

This makes GtkTreeView always cache the contents using pixelcache.
Comment 3 Christian Hergert 2015-06-17 00:00:49 UTC
I also notice that after initially attaching a model, I see a lot fewer full exposes now (presumably caused by row sizing/etc).
Comment 4 Alexander Larsson 2015-06-17 07:11:01 UTC
Review of attachment 305439 [details] [review]:

sure
Comment 5 Alexander Larsson 2015-06-17 07:13:43 UTC
Review of attachment 305440 [details] [review]:

This will use some more memory for things that display treeviews that rarely change but are often visible, say like a sidebar.
However, we blow unused caches after 20 seconds, so this will only affect the active app, so it is probably ok.
Comment 6 Christian Hergert 2015-06-17 07:31:58 UTC
Yeah, I was thinking the same thing. Just a bit more memory but only temporarily and it can potentially save a bunch of operations that could be more expensive than the bit extra memory.
Comment 7 Benjamin Berg 2015-08-19 20:06:46 UTC
I have a python application here that apparently is slightly broken and calls set_model after the GtkTreeView has been destroyed. I think in this case it is an idle handler that is still holding on to the widget after it has been destroyed.

This application crashes because of this patch. A simple check whether pixel_cache is not NULL should fix the crash.

Not quite sure about the guarantees that GTK+ does here, but it seems wrong to crash in this case.
Comment 8 Christian Hergert 2015-08-20 18:15:56 UTC
Thanks for reporting.

I went ahead and put the NULL check in place as suggested. Should preserve the previous state of things.

Fixed in commit b37400752bdc282888e13c9d74aa3e904bab8283.