Benchmarks
Apple M1 Pro, 2026-10-31.
5.9xfaster on Node 22 (short)
3.1-3.2xfaster on Node 24
3.0-3.3xfaster on Bun 1.4.4
1.48 MBdarwin-arm64 binary
thaiwrap vs Intl.Segmenter wrapper
Average time per call, lower is better. "short" is the 38-character example. "long" is the same text repeated 300 times. Bars are scaled to the reference.
Node 22.19.0 short
5.91x
Node 22.19.0 long
5.76x
Node 24.22.2 short
3.18x
Node 24.22.2 long
3.06x
Bun 1.4.4 short
3.34x
Bun 1.4.4 long
3.00x
The reference is the wrapper used in the tests. It breaks at word boundaries, so it does the same work as thaiwrap only on Thai-letter text such as these inputs.
Pure Rust core
| Benchmark | Input | maxLength | µs per call |
|---|---|---|---|
| short | 1x sample (38 chars) | 10 | 1.89 |
| long | 300x sample | 10 | 555.62 |
| mixed | 50x Thai/Latin/emoji | 20 | 115.90 |
| overflow_max4 | 300x sample | 4 | 760.21 |
| graphemes_long | 300x sample, graphemes | 10 | 632.32 |
criterion mean, median of 3 runs. Single machine, not guaranteed idle. Numbers from docs/m0/benchmarks.md.
Run it yourself
bun run build bun run bench # Bun node bench/index.mjs # Node cargo bench -p thaiwrap-core