DEV Community

Aleksandr Argunov
Aleksandr Argunov

Posted on Originally published at argbe.tech AI-assisted

Pele vs Mermaid benchmark: 347x warm, 14x to 20x on first render

Pele's site says up to 500× faster than Mermaid.js, and gives no method on the page. So here's a measured one: 347× once warm, 14.7× on the first render. Swap the order the two renderers run in, and that second number becomes 19.9×.

Animated score of Pele against Mermaid.js in Chrome. A wall of small orange Pele renders fills up around one large Mermaid diagram, which finishes last.

Pele is the open source renderer from Obsidian, credited to kepano. It replaced Mermaid in Obsidian 1.15.0 early access.

Method

Measured Nov 3, 2026, on an Apple M1 Pro. Headless Chrome 156.0.8078.48 through Playwright, Pele 1.13.0, Mermaid 12.2.0.

  • Sample: one diagram, the flowchart on pele.run, on five fresh pages.
  • First render: one Pele render, then one Mermaid render, each ending with host.innerHTML = svg.
  • Warm: 3,000 Pele renders, then 150 Mermaid renders. The window is the median of the last 100 Mermaid renders. The test counts Pele renders inside it, because one is too quick for performance.now().

Timing starts after both scripts load and stops once the SVG is in the DOM. It excludes download, script parse and paint. It says nothing about the code cache on repeat visits, other diagram types, other browsers or slower machines.

The five saved runs

Run Pele first (ms) Mermaid first (ms) Ratio Gap (ms) Mermaid warm (ms) Warm count
1 17.5 190.7 10.9× 173.2 34.0 339
2 12.3 176.7 14.4× 164.4 34.6 347
3 11.6 170.4 14.7× 158.8 33.8 370
4 11.3 174.6 15.5× 163.3 33.2 374
5 11.8 183.5 15.6× 171.7 33.2 324
Median 11.8 176.7 14.7× 164.4 33.8 347

That's about 0.1 ms per warm Pele render: 34.6 / 347. pele.run's table lists 0.05–0.3 ms for Pele and 6–82 ms for Mermaid.

Pele's own benchmark also sets innerHTML. Drop insertion on Pele's side only and the median count reads 769. That isn't a fair score, since Mermaid's window still includes insertion. It shows about half of a warm Pele render is DOM work.

The first-render ratio moves

A rerun on the same machine and Chrome version gave 346× warm and 14.3× on first render, with a 173.1 ms gap. The machine was busy: one-minute load ranged from 4.3 to 16.4.

Then the order alternated across 20 fresh pages:

Goes first Pele (ms) Mermaid (ms) Ratio Gap (ms)
Pele 11.9 165.9 14.0× 154
Mermaid 8.4 166.4 19.9× 158

Mermaid barely moves. Pele loses about 3.5 ms when it goes first. The test doesn't show why, and the plain HTML file below runs Pele first and still gets a median of 19.1×.

Across these sets the ratio sat between 14× and 20×. The gap stayed between 154 and 173 ms. Quote the gap.

Run it on your own diagram

Save as bench.html, swap in your diagram and open it in Chrome.

<!doctype html>
<div id="host"></div>
<pre id="out">running…</pre>
<script src="https://cdn.jsdelivr.net/npm/pele@1.13.0/dist/pele.global.js"></script>
<script src="https://cdn.jsdelivr.net/npm/mermaid@12.2.0/dist/mermaid.min.js"></script>
<script type="module">
    const src = `flowchart TD
  A[Mermaid text] --> B{Flowchart?}
  B -- Yes --> C[Pele]
  B -- No --> D[Mermaid]
  C --> E([SVG])
  D --> E` // swap in your own diagram

    mermaid.initialize({ startOnLoad: false, securityLevel: 'strict' })
    let i = 0
    const pelePut = () => {
        host.innerHTML = pele.render(src).svg
    }
    const mermaidPut = async () => {
        host.innerHTML = (await mermaid.render('m' + i++, src)).svg
    }
    const median = (a) => [...a].sort((x, y) => x - y)[a.length >> 1]

    let t = performance.now()
    pelePut()
    const peleFirst = performance.now() - t
    t = performance.now()
    await mermaidPut()
    const mermaidFirst = performance.now() - t

    for (let k = 0; k < 3000; k++) pelePut()
    const times = []
    for (let k = 0; k < 150; k++) {
        t = performance.now()
        await mermaidPut()
        times.push(performance.now() - t)
    }
    const slot = median(times.slice(50))

    // One Pele render is too quick to time alone, so count how many fit in one Mermaid render.
    let warm = 0
    t = performance.now()
    while (performance.now() - t < slot) {
        pelePut()
        warm++
    }

    out.textContent = `first render: Pele ${peleFirst.toFixed(1)} ms, Mermaid ${mermaidFirst.toFixed(1)} ms, ${(mermaidFirst / peleFirst).toFixed(1)}x
warm: ${warm} Pele renders in one ${slot.toFixed(1)} ms Mermaid render`
</script>
Enter fullscreen mode Exit fullscreen mode

One run on the same M1 Pro, headless:

first render: Pele 8.7 ms, Mermaid 167.9 ms, 19.3x
warm: 379 Pele renders in one 33.4 ms Mermaid render
Enter fullscreen mode Exit fullscreen mode

Render at build instead

If your diagrams don't change in the browser, you can skip both client renderers. Pele's render() runs in plain Node:

// npm i pele@1.13.0, then node build.mjs
import { writeFileSync } from 'node:fs'
import { render } from 'pele'

const { svg } = render(`flowchart TD
  A[Mermaid text] --> B{Flowchart?}
  B -- Yes --> C[Pele]
  B -- No --> D[Mermaid]
  C --> E([SVG])
  D --> E`)

writeFileSync('diagram.svg', svg)
console.log(svg.length, 'characters,', typeof document === 'undefined' ? 'no DOM' : 'DOM')
Enter fullscreen mode Exit fullscreen mode

Output: 3611 characters, no DOM. That's 1.1 kB gzipped. Mermaid's SVG for the same diagram, from Chrome, is 75 kB, or 18 kB gzipped. In plain Node, Mermaid throws document is not defined, so a build needs mermaid-cli, with Puppeteer as a peer dependency.

Node's SVG isn't byte-identical to Chrome's, which is 3,645 characters. Check it with your own fonts.

Size

gzip -9 of the published single-file bundles: Pele 273,493 bytes, Mermaid 1,566,733 bytes. That's 1,293,240 apart. pele.run lists 230 kB. Your bundler and cache change what transfers.

Before you swap

Pele's compatibility page targets Mermaid 12.1.0 syntax, and says "Node positions, spacing, and edge paths differ from Mermaid." HTML labels, Mermaid themes, ZenUML and JavaScript click callbacks are all listed as unsupported or ignored.

Two quick checks with Mermaid at securityLevel: 'loose': an <img> in a label survives in Mermaid's SVG, while Pele keeps the word and drops the image. And %%{init: {"theme":"forest"}}%% puts #cde498 in Mermaid's SVG, and not in Pele's.

The maintained version, with which number applies to which kind of page, is on argbe.tech.

Top comments (0)