GNOME Bugzilla – Bug 313991
Optimization of GtkRange
Last modified: 2005-08-20 05:58:08 UTC
I noticed that the scrollbar is always redrawn if the the GtkAlignment changes. Now for example in the gnome-terminal it often happens that lines are added in the terminal, and the GtkAlignment changes. But since the buffer is already full, or the minimum size of the slider is reached the layout of the GtkRange does not change. The attached patch is my first try to optimize this by only forcing a redraw if the layout of the slider changed. In my pretty dumb tests (with the clearlooks theme) I had the following results. measured with: time bash -c 'for i in `seq 0 20000`; do echo asdfasdf; done' If no notebook is visible: before: real 0m14.623s user 0m0.965s sys 0m0.067s after: real 0m9.788s user 0m1.239s sys 0m0.083s with a notebook present: before: real 0m16.006s user 0m1.217s sys 0m0.082s after: (this does not change a lot obviously) real 0m9.994s user 0m1.243s sys 0m0.087s
Created attachment 51011 [details] [review] the patch
2005-08-20 Matthias Clasen <mclasen@redhat.com> * gtk/gtkrange.c (gtk_range_adjustment_changed) (gtk_range_adjustment_value_changed): Don't queue a draw if the layout has not changed. (#313991, Benjamin Berg)