On Mon, Aug 29, 2022 at 03:52:19PM -0400, Scott Kostyshak wrote: > I think the speedup will be even faster if we could make Paragraph::latex() > thread-safe.
Before tuning threads - are you sure that the sequential run can be broken in this way, i.e. whether subsequent paragraphs are not dependent on some information produced before (like some counters, etc)? > If I protect it with a mutex, then things work much better. But that's > exactly the code that I need to run in parallel for my knitr child documents > to export in parallel. Could someone explain intuitively why this code is not > thread-safe? Is there any hope of making it thread-safe without major surgery? The bottlenecks I typically experience are of two kinds: 1) pictures conversion (having parallel code would be great even for document load when ton of pics gets converted!) 2) final pdflatex compilation The latex generation part is just neligible. Point 1 seems to be a good candidate for paralelization. External calls (like knitr) might be as well in case, again, its evaluation can't be dependent on the previous insets. But in this case I am almost sure some previous knitr inset might produce something needed for the subsequent ones ... Pavel -- lyx-devel mailing list lyx-devel@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-devel