[libvoikko] HFST/ooovoikko slow startup

Flammie Pirinen flammie at iki.fi
Sun Nov 14 23:04:54 EET 2010

2010-11-11, Harri Pitkänen sanoi:

> Ok. I made some changes to ooovoikko to slightly improve the
> debugging output related to initialization. If you take the latest
> source from SVN and build it with
> you get a debug version of the extension.

Ok, one of the problems I've been  having lately with ooovoikko is:

src/grammar/GrammarChecker.cxx:127: error: call of overloaded
'valueOf(int&)' is
ambiguous /usr/lib/openoffice/basis3.2/sdk/include/rtl/ustring.hxx:1360:
note: candidates are: static rtl::OUString
rtl::OUString::valueOf(sal_Bool) /usr/lib/openoffice/basis3.2/sdk/include/rtl/ustring.hxx:1374:
note:                 static rtl::OUString
rtl::OUString::valueOf(sal_Unicode) /usr/lib/openoffice/basis3.2/sdk/include/rtl/ustring.hxx:1388:
note:                 static rtl::OUString
sal_Int16) /usr/lib/openoffice/basis3.2/sdk/include/rtl/ustring.hxx:1405:
note:                 static rtl::OUString
sal_Int16) /usr/lib/openoffice/basis3.2/sdk/include/rtl/ustring.hxx:1421:
note:                 static rtl::OUString
rtl::OUString::valueOf(float) /usr/lib/openoffice/basis3.2/sdk/include/rtl/ustring.hxx:1437:
note:                 static rtl::OUString

but I can always change the initialisation to empty since I am not
interested of grammar checker atm.

> After installing it and
> starting OOo from the console you can see the debug logging on
> console. Initialization of libvoikko happens between these two lines:
> VOIKKO_DEBUG: PropertyManager::initLibvoikkoWithVariant: voikkoInit
> VOIKKO_DEBUG: PropertyManager::initLibvoikko: libvoikko initalized

I cannot get any debug to appear; I did try:

  522  make VOIKKO_DEGUB=FULL 
  523  make VOIKKO_DEGUB=FULL oxt
  524  sudo unopkg list --shared
  525  sudo unopkg remove --shared org.puimula.ooovoikko
  528  sudo unopkg add --shared build/voikko.oxt 
  529  oowriter 
  533  /usr/lib/openoffice/program/soffice -writer
  536  /usr/lib/openoffice/program/soffice.bin -writer

Without any debug printed to terminal. I will investigate it further
later on.

> It appears that there are no extra loading or unloading at startup.
> So this is not where the problem is. Reloading is done on purpose
> when certain settings are changed and this can cause delays during
> use but it should not happen very often and especially not here.

No, one thing I think commonly happens is that going to settings of a
some sort, maybe even font settings, which has the language setting to
change, may cause a reload, even when I've thought I hadn't changed
anything relevant, but I have to recheck.

> One thing I noticed from your Greenlandic patch is that the
> configuration file enables all four HFST backends. In OOo you would
> not need HFST morphology backend at all, disabling it by setting
>   Morphology-Backend: null
> could help decreasing the load time. I think libvoikko needs to be
> changed so that backend initialization is delayed until it is
> actually needed. This would allow enabling these rarely used backends
> without unnecessarily increasing the time it takes to start up when
> only spellers is needed.

Shouldn't make a difference, if you check the other patch, you'll see
the optimized stuff I've used for testing loads nothing in
HfstMorphology nor HfstHyphenation. Anyways, they should also
implemented so that they can share the automata, as long as linguist
does not require different automata for different tasks, for whatever

> Fully delayed loading does have the problem that applications
> generally expect to be notified about errors during initialization.
> If we delay the actual initialization too far it could become a
> problem. Perhaps the solution would be to only do some simple sanity
> checks on startup (do we have all the required files, do they have
> valid signatures etc.) and do the actual loading (reading the
> transducers to memory) when they are used for the first time.

Exactly, sounds very reasonable approach in any case.

Flammie, computer scientist bachelor, linguist master, free software
Finnish localiser, and more! <http://www.iki.fi/flammie/>

More information about the Libvoikko mailing list