GNOME Bugzilla – Bug 765265
updating matching brackets is slow
Last modified: 2016-05-12 12:51:46 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.
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
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).
I guess easiest way would be to queue up the scan after a small timeout
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.
Review of attachment 326369 [details] [review]: looks great. Thanks for all this optimization work