Rust allocators in WebAssembly: November 2026
- Reference machine
- Apple M4 Pro (arm64) · macOS 26.5.2
- Browsers
- Chrome 156 · Firefox 151 · Safari 26
- Input
- Silesia xml: 21 documents, 5.32 MB
- Samples
- 20 per allocator
1. Main points
2. Time per document
Figure 1. talc took 3.8% less time per document than dlmalloc in Firefox; bump‑scope took 4% more time than bumpalo in Chrome and Firefox
Median time per document and observed min–max of 20 samples; compare within each class.
Arrow keys move between points; Enter pins one so its values stay shown; Escape clears.
3. All allocators
| Allocator | Chrome 156 | Firefox 151 | Safari 26 | Heap growth | Download (brotli) |
|---|---|---|---|---|---|
| General-purpose · compared with dlmalloc | |||||
| dlmallocRust's default | 2.22 msbaseline | 2.54 msbaseline | 2.19 msbaseline | 100 pages6.25 MiB | 16.04 kBbaseline |
| talcglobal allocator | 2.17 msabout the same (2.5% less) 95% CI 2.2–2.7% less | 2.45 ms3.8% less time 95% CI 3.1–4.9% less | 2.15 msabout the same (1.3% less) 95% CI 1.0–1.6% less | 104 pages6.50 MiB | 14.13 kB−1.92 kB vs dlmalloc |
| Arena · compared with bumpalo | |||||
| bumpalobump arena | 1.72 msbaseline | 2.00 msbaseline | 1.73 msbaseline | 521 pages32.56 MiB | 18.14 kB+2.10 kB vs dlmalloc |
| bump-scopescoped bump arena | 1.79 ms4.0% more time 95% CI 3.7–4.2% more | 2.08 ms4.0% more time 95% CI 3.3–4.4% more | 1.76 msabout the same (1.3% more) 95% CI 0.9–2.0% more | 521 pages32.56 MiB | 17.88 kB+1.83 kB vs dlmalloc |
Measurement notes
- Conditions
- Chrome 156.0.8078.80 (headless) on macOS 26.5.2 (25F84); Apple M4 Pro, arm64, 14 logical cores; on AC power, Low Power Mode off. Captured 9 November 2026, 01:49–01:49 UTC. Capture 1 of 2.
- Clock
- Cross-origin isolated. Timer resolution in a worker 5 µs (median step; finest 5 µs).
- Method
- 20 samples per row, each a batch of at least 50 ms divided by its repetitions. Untimed warm-up of at least 250 ms and 2 rounds (at most 20). Order rotated by one each round; ratios are paired by round.
- Documents
- 21 XML documents from the Silesia corpus's xml file (a tar), 5.32 MB in all, 2.24 kB to 735 kB (median 221 kB), processed largest first so memory kept from a large document shows when smaller ones follow.
- Allocator calls
- In dlmalloc's build, each batch asks the allocator for 991,869 allocations, 271,178 grows and 991,869 frees (80.8 MB requested), about 60,145 allocations and grows per document, counted in an untimed pass.
- Classes
- dlmalloc and talc are general-purpose: they free each allocation on its own, so freed memory is reused while the program runs. bumpalo and bump-scope are arenas: they free everything at once when reset and can't free single allocations, so memory only grows until then. The two classes do different jobs, so allocators are compared only within a class.
- Workload
- Each document is parsed into an owned tree, walked with short-lived temporaries and dropped, while a small survivor set stays in the global allocator; the arena builds reset their arena after every document. All four builds run the same code on allocator-api2's collections (why). The workload in full.
- Timing
- Single-threaded. A sample times whole batches of every document, cleanup included (dropping each tree and, for arenas, the reset), divided by the number of documents. All four allocators run in every round, in an order rotated each round, so within a class each round gives one time ratio: its median and 95% CI decide a claim (beyond 3%, with a CI excluding 1). The first batch on a fresh instance is reported apart as First batch: it runs cold code and pays for memory.grow.
- Heap growth
- Linear memory after a fixed sequence of 3 batches on a fresh instance, minus its size once the documents are loaded, in 64 KiB pages; measured before any timing. Linear memory never shrinks, so these pages are kept for the module instance's lifetime. Differences within one page or 3% are not called.
- Download size
- Brotli (quality 11) bytes of each module as shipped, after wasm-opt -Os, computed at build time; raw: dlmalloc 45.91 kB, talc 40.58 kB, bumpalo 53.38 kB, bump-scope 51.70 kB. Each module is the whole application, and the arena builds also link dlmalloc for their chunks and the survivor set, so the differences are between whole builds. Sizes are exact, so they need no second capture.
- Firefox 151 capture
- Firefox 151.0.3 (headless), captured 9 November 2026, capture 1 of 2. Raw per-round data (JSON)
- Safari 26 capture
- Safari 26.5.2, captured 9 November 2026, capture 1 of 2. Raw per-round data (JSON)
- Build
- rustc 1.99.1 (58cf8f9c3 2026-10-13); wasi-sdk-29; wasm-opt version 133 (version_133); wasm-bindgen 0.2.130. Release profile: opt-level 3, LTO true, codegen-units 1, target features none (no simd128), wasm-opt -Os.
- Libraries
- talc 5.1.1, bumpalo 3.20.3, bump-scope 2.4.1.
- Commit
ef16b9543512- Artifacts
4 wasm modules, SHA-256
alloc_bg.wasm45.9 kB507c0dd00c71371c4fbcd5a45aa96fca5728eae2ae20d598dfa3475a7148c6c3alloc_bump_scope_bg.wasm51.7 kBa72aceb4be6d70e45cfb4ac915047a8b6400f355ea88823d89fa263190798cd6alloc_bumpalo_bg.wasm53.4 kBbc5b316318ec854e04a4b367e3f7564525044084a2041903947d2ae8d222b00dalloc_talc_bg.wasm40.6 kB9e1abd73c109dbdb2a05136dce349ee174a98ee595ac1127bc1ecbddfcb297c9
- Corpus
- Silesia corpus subset (1 of 12 files), checked against pinned SHA-256 hashes when packed and by length when loaded.
- xml 5,345,280 bytes
0e82e54e695c1938e4193448022543845b33020c8be6bf3bf3ead2224903e08c
- xml 5,345,280 bytes
- Raw data
- Raw per-round data (JSON)
Reference edition 2026-11-08 ·Apple M4 Pro (arm64), macOS 26.5.2 (25F84) ·Chrome 156, Firefox 151 and Safari 26 ·20 samples per allocator ·Method ·Raw data (JSON)
4. Measure on this machine
Run all four allocators on the same documents.
Export after a run: CSV, JSON, Markdown