Juergen Spitzmueller wrote:

> Jean-Marc Lasgouttes wrote:
>> Juergen, if seems to me that the following code
>> +void InsetInclude::updateBibfilesCache(Buffer const & buffer)
>> +{
>> +     if (loadIfNeeded(buffer, params_)) {
>> [...]
>> +     }
>> +}
>> +
>> +std::vector<string> const &
>> +InsetInclude::getBibfilesCache(Buffer const & buffer) const
>> +{
>> +     if (loadIfNeeded(buffer, params_)) {
>> [...]
>> +     }
>> triggers a load of child document everytime the master document is
>> loaded. This is bad, especially since this behaviour depends on
>> whether natbib is used or not.
> 
> That's bad indeed. I think we should add another bool IsLoaded that checks
> if the file is loaded but does not load it.
> Georg, can you rephrase why exactly the insetinclude changes where needed?
> Would the proposed solution still work?

Only now I realize that always loading the documents was my fault. Sorry for
that, I should have complained to myself :-(

The insetinclude changes are needed because it is possible that the
bibliography is in an included file. Therefore we need to load the included
file when we fill the bib file cache.
What is maybe not needed is the call of updateBibfilesCache() in
Buffer::readDocument(). We could defer that until the cache is really
needed: Add a flag to Buffer that indicates whether the cache is needed.
This flag would be set to false initially. All calls of
updateBibfilesCache() would be a noop until this flag is set, and it would
be set in Buffer::getBibfilesCache(). Buffer::getBibfilesCache() would also
call updateBibfilesCache() if the flag was not set. From that point on the
cache would be kept valid.
This would avoid loading the child documents if they are not needed, but it
would not avoid loading them when natbib labels are used. This is simply
not possible if the natbib information should be correct.

Shall I implement that?


Georg

Reply via email to