mermaid-cli figure generation is very slow

84 Views Asked by At

I'm thinking of moving from graphviz to mermaid for my diagram sketches because of some mermaid feature which is not available in graphviz. I downloaded mermaid-cli, and with a custom puppeteerConfigFile ( {"executablePath": "/usr/bin/chromium"},), it works.

the mermaid_test.mmd file:

sequenceDiagram
 A-->B: Works!

the command I run

time mmdc -i mermaid_test.mmd -o output.pdf --puppeteerConfigFile puppeteerConfigFile.json

the output:

Generating single mermaid chart

real    0m18,590s
user    0m0,946s
sys 0m0,348s

However, it is extremely slow, generating any kind of figure takes around 18 seconds. I had the suspicion that this is due to mmdc starting a new browser for every call, which seems to be the case.

But still, is this time normal/to be expected? I have basically no experience with JS/puppeteer, and I couldn't really find any github tickets or SO discussions related to speed, but I think not, because this is unbearable. When I start chromium itself it also starts pretty much instantly.

Any ideas what is going on here, and how I can make mermaid-cli faster?

0

There are 0 best solutions below