2 changes to make a11y quite a bit faster especially when performing bulk search & replace.
The first commit makes use of the character offset cache when performing reverse-lookup, e.g. when we need to convert a position given by the a11y layer to one understood by Scintilla.
The second avoids clearing the cache when it gets invalidated, and instead updates it to be valid right away. This avoids potentially costly re-computation of the cache that becomes problematic when we often need a position near the end of the file but keep invalidating everything after lines near the start. This happens especially when performing bulk search & replace with the cursor near the end. This gives a slightly higher cost at invalidating the cache (that now updates it based on a known delta), but a lot less when it's content is needed again.
Fixes #2092. You can view, comment on, or merge this pull request online at:
https://github.com/geany/geany/pull/2097
-- Commit Summary --
* scintilla: GTK: a11y: Optimize byte to character offset conversion * scintilla: GTK: a11y: Avoid clearing cache when possible
-- File Changes --
M scintilla/gtk/ScintillaGTKAccessible.cxx (15) M scintilla/gtk/ScintillaGTKAccessible.h (14)
-- Patch Links --
https://github.com/geany/geany/pull/2097.patch https://github.com/geany/geany/pull/2097.diff
Scintilla is a separate project to Geany, please submit Scintilla changes there, preferably to both Scintilla 3 and 4..
The Geany maintainer likes to be able to update Scintilla by the requisite script and adding patches is not part of that.
PS :grin:
Oh sorry. I though maybe you guys would like a chance to test this fix and see if it does help #2092, but I can indeed submit it first to Scintilla if you guys prefer.
PS: fair enough :smile:
I though maybe you guys would like a chance to test this fix and see if it does help
Yeah, I figured that was why, but the automatic response was just too strong :smile: . I can't test just now, but maybe the OP can.
@b4n pushed 1 commit.
e7f32ec5ebe55b4520e5aa79ff5ceb5fa6aac13a scintilla: GTK: a11y: Avoid unnecessary vector size computation
@b4n pushed 2 commits.
55f547d0fab4b5f7085ad7d0a88d52c80c957056 scintilla: Accessible: add a FIXME ea81d46da5f09e23538e7c0def80f7bf2e65b779 scintilla: Accessible: use Scintilla's own character offset cache
Improved it further to simply use Scintilla's built-in position cache which is actually faster, and makes the code simple. Submitted upstream: https://sourceforge.net/p/scintilla/bugs/2094/.
Fixes issue for me. Fixes also slow undo. I also noticed that the first iteration is slow too when done with cursor at the end. BTW this issue was not present (for me) in stock geany 1.29 from Debian Stretch (built with GTK+2).
@johndescs thanks for testing!
BTW this issue was not present (for me) in stock geany 1.29 from Debian Stretch (built with GTK+2).
It's to be expected, as the offending code appeared in 1.30. But it might also be affected by the GTK version, as the code for instantiating the accessible object is fairly different on GTK2, and IIRC might disable it if the toolkit isn't currently enabling it somehow. Might be interesting to check, but shouldn't change too much when a11y is actually enabled.
Merged #2097 into master.
Merged the version that made it to upstream Scintilla. It's the same with an additional check which only matter when Scintilla is not in Unicode mode, so doesn't affect us.
Merged the version that made it to upstream Scintilla.
Why? Its in Scintilla 3.10.4 that was released 10 minutes ago (at time of writing), why not just upgrade to that (subtle hint)? Weren't you able to see into the future to know that was going to happen? :grinning:
github-comments@lists.geany.org