Calc / spell check cache
Michael Meeks
michael.meeks at collabora.com
Mon Oct 5 13:27:04 UTC 2020
Hi Dennis,
Moving this to libreoffice-dev since it's generally interesting, hope
that's ok.
Summary: we have a problem whereby calc spell-checking causes cascades
of invalidations caused by spell-checking idle handlers; it seems when
the view moves, we render, and then do lots of invalidation - which is
generally inefficient even for the PC case I guess; but particularly so
for online. Also - now we have SharedStrings so we can cache spelling
information more easily for the case of large numbers of duplicate
mis-(or correctly) spelled words - for large pivot data source ranges eg.
On 05/10/2020 11:56, Dennis Francis wrote:
> Calc perf: spell-check invalidation
>
> Status : WIP, works mostly, need to fix the TODO items (below).
Wonderful =)
> * WIP patch for cp-6.4 at
> https://gerrit.libreoffice.org/c/core/+/103941
Thanks.
> * removed timer based spellcheck related code/members.
> * spellchecks done only when needed (paintTile -> DrawEdit etc.)
> * results are cached with better cache-invalidation.
Great.
> * spellcheck-results cache has two maps:
> #1: for shared-string cells, #2: for edit-text-object cells.
Nice.
> #1 uses raw-pointer to rtl_uString as key.
I guess that would work, we just need to be a bit careful we need to
make sure we clear this cache before we call:
void SharedStringPool::purge()
In ScDocument::~ScDocument - I think.
> #2 uses cell-address as key.
Does the EditTextObject hold and cache its own spelling status ?
> There is a third map for any special cells with a different language> set (ATTR_FONT_LANGUAGE), but it is not used for storing spellcheck
results.
Interesting =)
> (test document used was created from first sheet of go-oox.xlsx without the
> content under "SCRIPT TYPES", refer TODO.)
>
> * don't see unnecessary tile-invalidations on scrolling the test document.
Wonderful =)
> Attached the flame-graphs with and without the fix.
For me - I got 50% CPU use in a loolkit backend scrolling a single view
without the patch; hopefully that starts to be fast and ~free CPU-wise =)
> * TODO for the patch:
>
> * There is a crash on loading documents in online with cell contents with
> asian/complex script types. Does not happen with desktop core though.
Interesting; valgrind ?
> * Get the document's language or whatever online sets as the language as the
> default instead of using ScGlobal::GetEditDefaultLanguage() (which seems to return the language associated with the default-locale),
> else the cache becomes inefficient in case document-language != default-locale-language.>> * enforce cache size limits (for each internal map).
Looks very promising.
Thanks !
Michael.
--
michael.meeks at collabora.com <><, GM Collabora Productivity
Hangout: mejmeeks at gmail.com, Skype: mmeeks
(M) +44 7795 666 147 - timezone usually UK / Europe
More information about the LibreOffice
mailing list