Large autocorrect databases cause quite some slowness on first keystroke for people; turns out we had quite a gratuitous N^2 on load there involving some ICU collation goodness ;-)
It's still not ideal to have a multi-second freeze, but at least it's half the length it was ;-) Review appreciated, Thanks, Michael. On Sat, 2012-04-28 at 06:32 +0000, wrote: > https://bugs.freedesktop.org/show_bug.cgi?id=46805 > > --- Comment #22 from tommy27 <ba...@quipo.it> 2012-04-27 23:32:34 PDT --- > ok, I downloaded the: > master~2012-04-27_21.25.23_LibO-Dev_3.6.0alpha0_Win_x86_install_en-US.msi > > and made comparative testings. ... > 1 large autocorrect database (acor_.dat) > time to see the white space > > LibO 3.5.2 --> 9 seconds > LibOdev 3.6.0 --> 5 seconds > > 2 large autocorrect databases (acor_.dat ; acor_it-IT.dat) > time to see the white space > > LibO 3.5.2 --> 14 seconds > LibOdev 3.6.0 --> 9 seconds -- michael.me...@suse.com <><, Pseudo Engineer, itinerant idiot
>From b269dced445494891a8e6e8d1d62b931a31dddbd Mon Sep 17 00:00:00 2001 From: Michael Meeks <michael.me...@suse.com> Date: Thu, 26 Apr 2012 11:59:02 +0100 Subject: [PATCH] fdo#46805 - special-case appending items to autocorrect lists --- editeng/source/misc/svxacorr.cxx | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index f459af0..ce5c71c 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -68,6 +68,7 @@ #include <com/sun/star/ucb/NameClash.hpp> #include <xmloff/xmltoken.hxx> #include <vcl/help.hxx> +#include <rtl/logfile.hxx> #define CHAR_HARDBLANK ((sal_Unicode)0x00A0) @@ -233,15 +234,27 @@ void SvxAutocorrWordList::DeleteAndDestroy( sal_uInt16 nP, sal_uInt16 nL ) } +// Keep the list sorted ... sal_Bool SvxAutocorrWordList::Seek_Entry( const SvxAutocorrWordPtr aE, sal_uInt16* pP ) const { register sal_uInt16 nO = SvxAutocorrWordList_SAR::Count(), nM, nU = 0; + if( nO > 0 ) { CollatorWrapper& rCmp = ::GetCollatorWrapper(); nO--; + + // quick check of the end of the list + if (rCmp.compareString( aE->GetShort(), + (*((SvxAutocorrWordPtr*)pData + nO))->GetShort() ) > 0) + { + if( pP ) *pP = nO + 1; + return sal_False; + } + + // Incredibly crude sort algorithm, should use some partitioning search. while( nU <= nO ) { nM = nU + ( nO - nU ) / 2; @@ -2169,6 +2182,7 @@ SvxAutocorrWordList* SvxAutoCorrectLanguageLists::LoadAutocorrWordList() OSL_ENSURE( xXMLParser.is(), "XMLReader::Read: com.sun.star.xml.sax.Parser service missing" ); if( xXMLParser.is() ) { + RTL_LOGFILE_PRODUCT_CONTEXT( aLog, "AutoCorrect Import" ); uno::Reference< xml::sax::XDocumentHandler > xFilter = new SvXMLAutoCorrectImport( xServiceFactory, pAutocorr_List, rAutoCorrect, xStg ); // connect parser and filter -- 1.7.9
_______________________________________________ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice