bug#66507 has a nice profile for a particularly slow to calculate document which shows that the FormulaTokenIterator::Jump and Push / Pop methods are particularly expensive source of the slowness there - primarily because of all the allocation and freeing they do of ImpTokenIterator structures.
class FORMULA_DLLPUBLIC FormulaTokenIterator
We should make the ImpTokenIterator struct a private (but present in the header) class of FormulaTokenIterator.
We should also undo this very strange manual memory management / fragile linked list nonsense, and instead use a simple in-place vector [ie. not doing all this allocation ]. We should just push_back and pop stuff onto the vector and avoid the linked list sillies.
Of the 390bn cycles of the complete load/edit/save trace here, ~35bn are spent allocating and freeing this structure :-)
Hmm, it's worse than this there is another 26bn cycles in 'PushWithoutError' here.
This is now implemented & patch submitted
Jeffrey Stedfast committed a patch related to this issue.
It has been pushed to "master":
fdo#81038 Fixed FormulaTokenIterator to use std::vector instead of linked list
The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
Affected users are encouraged to test the fix and report feedback.
Migrating Whiteboard tags to Keywords: (EasyHack DifficultyInteresting SkillCpp TopicCleanup)