# Benchmarks

Render speed and download size of Ondine, Pele 1.6.0, and Mermaid 12.1.0, each in its best measured configuration.

Each library rendered all 612 vectors of 33 diagram types in headless Chromium 141. The run used commit `1c9f5d6` on a 4-core Intel Xeon at 2.10 GHz. The colors in each table compare a library with Ondine.

[`bench/comparison.md`](https://github.com/wevm/ondine/blob/main/bench/comparison.md) contains the full report. The `pnpm bench:compare` command reproduces the report.

## Mount Speed

Warm render is the average time for each diagram over all 612 vectors, after the library loads. Cold render is the time from the library load in a new page to its first diagram. It is the average over the 33 types.

| Render | Ondine |   Pele | Mermaid |
| ------ | -----: | -----: | ------: |
| Warm   | 54.9µs |  151µs |  36.8ms |
| Cold   |   34ms | 55.6ms |   300ms |

For warm render, Ondine uses its speed-optimized module. For cold render, Ondine uses the size-optimized module of the diagram type. Pele loads through `pele/lazy`, and Mermaid renders with `mermaid.render`.

## Diagram Size

This table shows the bytes that a page downloads to display diagrams of all types. Ondine compiles diagrams ahead of time, so a page ships only the `ondine` runtime that mounts them. Pele and Mermaid ship their renderers. The sizes are from minified esbuild bundles.

| Bytes  | Ondine |   Pele | Mermaid |
| ------ | -----: | -----: | ------: |
| Gzip   |    127 | 248064 | 1506327 |
| Brotli |     93 | 200236 | 1252410 |
