# Optimized benchmark results Primary target: **Node 26.12.0 / o200k_base**. Bun 1.4.3 and cl100k are release-regression checks. All tables use five fresh processes; ranges are full process minimum–maximum, not confidence intervals. Ranks exclude the historical npm release. **The legacy arithmetic mean is dominated by two large synthetic inputs. It does not establish a universal winner.** Realistic categories and repeated/32-variant modes stand separately in the [overview](experiments/OVERVIEW.md); every per-document median loss is listed there. The [interpretation](OPTIMIZED-FINDINGS.md) discusses losses and tradeoffs. Host: benchmark-vm, 8 vCPUs presenting 13th Gen Intel(R) Core(TM) i7-1360P, 15.54 GiB; linux/x64, kernel 7.0.0-34-generic. KVM VM, no CPU pinning/frequency control. The queue prevents our jobs from overlapping; shared-host scheduling, turbo, JIT and GC remain uncontrolled. ## Node/o200k legacy target | Case | Checkout median [min,max] | Rank | npm 4.0.3 median [min,max] | |---|---:|---:|---:| | Encode ms/call | 3.939 [3.887, 4.018] | 1/10 | 7.009 [6.789, 7.350] | | Decode API-return ms/call (length only) | 0.369 [0.367, 0.375] | 1/10 | 7.416 [6.847, 7.593] | | Count ms/call | 3.166 [3.146, 3.216] | 1/10 | 5.928 [5.857, 5.953] | | Import + construction ms | 99.047 [94.039, 108.243] | 1/10 | 97.692 [96.101, 101.253] | | Settled init heap delta MiB | 16.114 [16.113, 16.114] | 5/10 | 16.002 [16.002, 16.002] | | Settled init RSS delta MiB | 45.512 [45.184, 45.887] | 1/10 | 44.961 [27.715, 45.215] | | One-pass retained heap growth MiB | 7.751 [7.751, 7.754] | 10/10 | 8.076 [8.076, 8.076] | | One-pass retained RSS growth MiB | 49.930 [48.664, 50.586] | 9/10 | 63.645 [62.711, 69.043] | | Absolute final heap MiB | 29.547 [29.547, 29.550] | 5/10 | 29.760 [29.760, 29.760] | | Absolute final RSS MiB | 167.996 [166.762, 168.289] | 3/10 | 180.207 [168.469, 181.199] | | One-pass process peak RSS MiB | 173.328 [172.098, 173.426] | 3/10 | 186.293 [172.594, 186.859] | Encoding/decoding/counting use the original seven-input mean per process. Load excludes process startup. Memory is a separate settled one-pass phase, including byte-heavy decode; final/peak RSS include harness/corpus. See [all contenders and every input](experiments/LEGACY-node-o200k-RESULTS.md). ## Informational release comparisons These selected runs compare the checkout with npm 4.0.3 only; they do not re-rank other competitors. Values below are legacy mean latency ratios: npm / checkout, so above 1 is a speedup. The linked tables include absolute latencies, load, and matching memory. | Engine / encoding | Encode speedup | Decode speedup | Count speedup | Detailed evidence | |---|---:|---:|---:|---| | node / cl100k_base | 1.694× | 18.228× | 1.877× | [Timing and memory](experiments/LEGACY-node-cl100k-RESULTS.md) | | bun / cl100k_base | 2.295× | 4.040× | 2.258× | [Timing and memory](experiments/LEGACY-bun-RESULTS.md) | | bun / o200k_base | 2.031× | 4.100× | 2.055× | [Timing and memory](experiments/LEGACY-bun-RESULTS.md) | ## Decode and read all output API-return timings read only result length and can leave decoded strings as lazy ropes. The [separate consumed-output comparison](experiments/CONSUMED-OVERVIEW-RESULTS.md) includes a checksum over every returned code unit, with [full absolute tables](experiments/CONSUMED-node-o200k-RESULTS.md). It measures decode plus the common consumer cost and is not pooled with API-return ranks. ## Longer confirmations Five new processes per entry, at least 500 ms warmup and 500 ms measurement per cell. Original runs remain unchanged; different budgets are not pooled. - [Realistic API-return decode confirmations](experiments/CONFIRM-REAL-DECODE-OVERVIEW-RESULTS.md) - [Decode-and-read confirmation](experiments/CONFIRM-CONSUMED-OVERVIEW-RESULTS.md) - [Node/o200k_base original-case confirmation](experiments/CONFIRM-LEGACY-node-o200k-RESULTS.md) - [Node/cl100k_base original-case confirmation](experiments/CONFIRM-LEGACY-node-cl100k-RESULTS.md) ## Correctness, versions, and reproduction - [node expanded gate](results/optimized-canonical-verified-correctness-node.json): zero failures; cl100k_base: 4984 strings + 350 valid-ID sequences, o200k_base: 4984 strings + 350 valid-ID sequences; seed `0x519be07`. - [bun expanded gate](results/optimized-canonical-verified-correctness-bun.json): zero failures; cl100k_base: 4984 strings + 350 valid-ID sequences, o200k_base: 4984 strings + 350 valid-ID sequences; seed `0x519be07`. | Package | Version | |---|---| | gpt-tokenizer:local | local | | gpt-tokenizer:npm | 4.0.3 | | tiktoken | 1.0.22 | | js-tiktoken | 1.0.21 | | tiktoken-node | 0.0.7 | | @huggingface/tokenizers | 0.2.0 | | tokenizers | 0.23.2 | | @mlc-ai/web-tokenizers | 0.1.6 | | @goliapkg/tiktoken-wasm | 4.1.2 | | bpe-lite | 0.5.2 | | ai-tokenizer | 1.0.7 | | @lenml/tokenizers | 3.7.2 | Every timed input matches independent token IDs/round trips/counts. Additional semantic-probe failures are retained in the overview and full reports; timed-input correctness does not imply universal API equivalence. [Selection/skips](README.md), [audit](AUDIT.md), and [optimization tradeoffs and rejected work](OPTIMIZATIONS.md) provide context. Executed build manifest SHA-256: `234366c4ce34cd74c1ea94d30a2147b029d47ff141437767c75da49f018fd9e1`. Primary source commit `0aa625fda20984ea0f874117496f830ed46c33c8`. Each linked report lists raw SHA-256, source/runtime/hardware, input hashes and actual budgets. Matching built modules are required across every final phase. Build and measure with `GPT_BENCH_CONFIRM=1 bash benchmark/experiments/reproduce.sh NEW_PREFIX`; omit the environment flag for first comparisons without longer confirmations. Regenerate these artifacts with `python3 benchmark/experiments/publish.py --prefix optimized-canonical --charts` after installing `benchmark/requirements-report.txt`. Historical pre-optimization [full engine/contender matrix](RESULTS.md) remains unchanged.