[LyX/master] Paragraph::needsCProtection(): use inset list

Jean-Marc Lasgouttes lasgouttes at lyx.org
Tue Dec 21 14:45:14 UTC 2021


Le 19/12/2021 à 15:13, Juergen Spitzmueller a écrit :
> commit 61b8afd893ecdbc15924aaf8f44014b41c5623ef
> Author: Juergen Spitzmueller <spitz at lyx.org>
> Date:   Sun Dec 19 15:39:49 2021 +0100
> 
>      Paragraph::needsCProtection(): use inset list
>      
>      rather than checking each pos whether it's an inset or not.
>      
>      This was a significant performance bottleneck (particularly getInset()
>      itself seems slow).

FWIW, running the hotspot profiler on an export to LaTeX of user guide 
tells me that needsCProtect and friends use 40% of CPU time; the export 
part of total run time is 60%. So cprotect handling is 2/3rd of export.

This happens because the code as I understand it goes several times 
through the same inset hierarchy.

The right way to do such things IMO is the updateBuffer machinery. In 
the same profile, it uses only 3.6% of total time; or we could use 
validate, which clocks at 1.74%

I could try to help with this, but for that I would have to understand 
what the code does (and what cprotect does).

JMarc


More information about the lyx-devel mailing list