Last I mentioned I was doing an ABI cleanup of libspelling as it was really just a couple hour hack that got used by people.
Part of that was to make way for performing spellchecking off the GTK thread. That just landed in today’s libspelling 0.3.0 release. In one contrived benchmark, spellchecking a 10,000 line document was 8x faster. YMMV.
One of the reasons it’s faster is we don’t need to use the GtkTextIter
API. Pango provides all the things we need to do that without the PangoLayout
overhead. So we just skip right past that and implement iterators off-thread.
I also extracted the GtkTextBuffer
adapter so that we may add a GtkEditable
adapter in the future. Internally, the adapters provide a series of callbacks to the SpellingEngine
.
You might wonder what happens if you make an edit that collides with a region being spellchecked off thread? The answer is quite simple, it checks for collisions and either adapts by adjusting offsets or discards irreconcilable collisions.
Both Text Editor and Builder have been migrated to using libspelling
instead of its ancestor code. If you’re running nightly Flatpak of those, take a crack at it and report bugs.
“It testing could use.”