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 313991 - Optimization of GtkRange
Optimization of GtkRange
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2005-08-19 22:59 UTC by Benjamin Berg
Modified: 2005-08-20 05:58 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
the patch (2.50 KB, patch)
2005-08-19 23:00 UTC, Benjamin Berg
none Details | Review

Description Benjamin Berg 2005-08-19 22:59:09 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
Comment 1 Benjamin Berg 2005-08-19 23:00:25 UTC
Created attachment 51011 [details] [review]
the patch
Comment 2 Matthias Clasen 2005-08-20 05:58:08 UTC
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)