Jean-Marc Lasgouttes wrote:
"Vincent van Ravesteijn - TNW" <[email protected]> writes:
As far as I understood, there are links to macros stored in a table.
This means that the table says that Macro_x is used in paragraph 10,
position 12 etc. If the document changes, one has to adjust these
numbers as the location might now be paragraph 11, position 12 after a
new paragraph is inserted.

But these links are only needed when a macro is changed, right?
Shouldn't the expensive operation (look over all files) be done on this
occasion only?

It seems to me that there are two (potential) problems. I've made suggestions about this elsewhere in the other thread, but let me repeat them here.

(i) The filesystem checks that are causing the slowdown for Vincent simply don't need to be done as often as they are. The checks are generated by a call to loadIfNeeded(). It seems to me that there are only a few occasions when a file could need to be loaded if it wasn't already. E.g., initially; if an InsetInclude has been added or modified; or if the default master has been changed; if a file has been saved under a new name; if a buffer has been closed. So we could have some flag, maybe in the BufferList, that meant: you don't need to check this, nothing has changed. And it could be set and cleared by e.g. InsetInclude constructors. I don't think there are that many cases to consider.

(ii) The updateMacros() call is probably being done too often, and for similar reasons. It must be possible to have a better sense than we apparently do of when it needs to be done, and set and clear a flag that will tell us when it does need to be done. E.g., if a macro is modified; if a paragraph is added or deleted; etc. We do this kind of thing for lots of other purposes, e.g., the FitCursor stuff and the drawing optimizations.

I'd be happy to work on at least the former, if the general idea seems reasonable to people.

rh

Reply via email to