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 765265 - updating matching brackets is slow
updating matching brackets is slow
Status: RESOLVED FIXED
Product: gtksourceview
Classification: Platform
Component: General
git master
Other Linux
: Normal enhancement
: ---
Assigned To: GTK Sourceview maintainers
GTK Sourceview maintainers
Depends on:
Blocks:
 
 
Reported: 2016-04-19 15:55 UTC by Christian Hergert
Modified: 2016-05-12 12:51 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
buffer: add short delay before updating matching-brackets (4.03 KB, patch)
2016-04-20 05:41 UTC, Christian Hergert
committed Details | Review

Description Christian Hergert 2016-04-19 15:55:06 UTC
This is showing up on profiles pretty regularly, (but not as high as some other things). I haven't looked into the reasoning, but I suspect its something that we can update asynchronously and are doing synchronously.

Just wanted to drop this here in case someone wants to look into it before I can.
Comment 1 Paolo Borelli 2016-04-19 16:11:06 UTC
Yeah, the scan for the matching bracket is not particularly smart. It was never much of a problem since it just looks within a fixed range
Comment 2 Christian Hergert 2016-04-19 16:18:14 UTC
I think normally it is fine, but the situation where you hit it a lot is when under rapid key repeat. (Say holding down arrow).
Comment 3 Paolo Borelli 2016-04-19 16:22:06 UTC
I guess easiest way would be to queue up the scan after a small timeout
Comment 4 Christian Hergert 2016-04-20 05:41:11 UTC
Created attachment 326369 [details] [review]
buffer: add short delay before updating matching-brackets

This adds a low-priority gdk timeout to perform the update to
matching-brackets.

It was discovered, using tests/test-widget, that holding arrow-down or
arrow-up to scroll while matching-brackets is enabled causes stutters in
the drawing. When disabling matching-brackets, this goes away.

By adding a short delay, we reduce the number of updates and invalidations
performed, which keeps us within our deadlines for smooth animations.

The value of 50 was found experimentally, binary searching down from 200
msec (the gtkscrolledwindow animation default) down to 25msec, which gave
unacceptable performance.
Comment 5 Paolo Borelli 2016-04-20 06:35:37 UTC
Review of attachment 326369 [details] [review]:

looks great. Thanks for all this optimization work