Skip to main content

Backends

Every backend sits behind the same Diagram API. Only svg() differs: PNG, JPEG, PDF, raw and NumPy output all come from the same novasvg pipeline.

BackendWhat runsUse it when
quickjs (default)The real mermaid.js in QuickJS-ngYou want the zero-dependency install, or any diagram type
v8The real mermaid.js in V8 through mini-racerYou render a lot and want JIT speed
mermanNative Rust, through mmdrYou want no JavaScript engine at all
mermaid-rs-rendererNative Rust, an alternative renderer from mmdrSame as above, with a different layout engine
import mermaidx

mermaidx.render(source) # quickjs
mermaidx.render(source, backend="v8")
mermaidx.render(source, backend="merman").pdf()

quickjs and v8​

Both run the same, unmodified mermaid.js against a small fake DOM, so they support the same diagram types and options (theme, config, css). The difference is the engine: V8 compiles to machine code and is faster, QuickJS is an interpreter that installs anywhere.

V8 runs in an isolated child process, so all of its memory is released when the render finishes.

One diagram, 39_mindmap_shapes, currently renders differently on V8. See known issues.

Rust backends​

merman and mermaid-rs-renderer are separate reimplementations, not mermaid.js. They take theme, node_spacing, rank_spacing and aspect_ratio instead of config and css. They may not support every diagram type, and their layout can differ from mermaid.js. The benchmark gallery shows exactly which samples each backend renders.

Speed​

Numbers depend on the machine, so the benchmark page publishes them for every sample, measured in CI on each release. See how the benchmarks work.