On 09/01/2018 10:02 AM, Jürgen Spitzmüller wrote:
> Am Samstag, den 01.09.2018, 13:49 +0200 schrieb Enrico Forestieri:
>> Using the --verbose switch it can be seen that each time a new
>> paragraph
>> is started LyX runs kpsewhich for each bibtex catalog to be found in
>> the
>> texmf tree. So, if you have 5 catalogs, kpsewhich is run for 5 times
>> everytime you hit the Enter key.
> Indeed, that's likely the culprit.
>
> The call is in InsetBibtex::getBibTeXPath(), which is called by
> InsetBibtex::getBibFiles(), which is called by
> InsetBibTeX::updateBuffer(), which is called by Buffer::updateBuffer()
>
> Would it make sense to cache those paths, too? After all, they are
> unlikely to change that often.

Weird that no-one saw this problem on Linux.

Here's a possibility: Cache the paths, as you suggest, and then, if
there's no file at
that location (when we look for it), re-run findtexfile to try to find
it. So we'd need
to find all the places the path is used. I note
Buffer::checkIfBibInfoCacheIsValid
(checking timestamps) and InsetBibtex::parseBibTeXFiles (which calls
getBibfiles
again) and Buffer::prepareBibFilePaths (which is passed the list).

I'm not entirely sure where it's best to put the cache. InsetBibtex is
an option, but
we really only need a single global one. So maybe a static std::map there?

Actually, if we do this, then we probably don't even need the
FileNamePairList
any more. We can just store the name as entered and use the cache to
find the
full path. But maybe we don't want to do anything so dramatic right now?

Riki

Reply via email to