Skip to content

bench(pipeline): add sebpop/upstream as a second reference series - #2221

Draft
SBrandeis wants to merge 3 commits into
feat/train_encode_splitfrom
bench-sebpop
Draft

bench(pipeline): add sebpop/upstream as a second reference series#2221
SBrandeis wants to merge 3 commits into
feat/train_encode_splitfrom
bench-sebpop

Conversation

@SBrandeis

@SBrandeis SBrandeis commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Bench the tokenizers crate from sebpop's performance branch (github.com/sebpop/tokenizers#upstream) alongside the released 0.23.1 in the pipeline benchmark: single-thread throughput per fixture, the multi-thread sweep, per-implementation memory footprint, minimal-binary size, and a report-only id-diff flag. The charts keep a single vs-release axis — sebpop renders as a second (green) bar next to the pipeline's.

The git dep uses sebpop's default features minus mimalloc: its override feature would swap the global allocator for the whole bench process and skew every series. Cargo.lock pins the resolved commit; cargo update tokenizers@0.22.3-dev.0 moves it to the branch tip.

Older cached bench JSONs (base-branch baselines) without the sebpop keys still render unchanged.

PipelineTokenizer benchmark

7 / 8 models supported — PipelineTokenizer vs tokenizers v0.23.1 (latest release) and sebpop/upstream · ~10 kB inputs · refs via encode_fast · mimalloc (all series) · single thread + 1/2/4/8/max-thread sweep

ae0478f5d · 2026-07-20 16:38 UTC · Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz · 32 cores

Per-model encode throughput vs latest release

vs base branch (bb98d4e1f) — per-model geomean ×speedup of this PR's PipelineTokenizer against the base branch's; regressions in red.

Per-model encode throughput vs base branch Per-model memory footprint Minimal encode binary size

ℹ️ Token ids differ from sebpop/upstream on: gpt-oss, gpt2 (‡ in the per-model charts).

bert-base-uncased — normalizer-heavy WordPiece · ×4.21 vs v0.23.1 · ×2.77 vs sebpop/upstream · ×1.01 vs base bert-base-uncased speedup bert-base-uncased stage decomposition bert-base-uncased thread scaling

Memory (RSS MB, load+encode): v0.23.1 8+13 (peak 21) · sebpop/upstream 8+11 (peak 19) · Pipeline 17+2 (peak 19)

Fixture Group v0.23.1 MB/s sebpop/upstream MB/s Pipeline MB/s vs v0.23.1 vs sebpop/upstream Δ base added-token normalize pre-tokenize model Ids
amh_Ethi lang 8.8 15.0 27.4 ×3.11 ×1.83 ×1.00 3% (1.2) 76% (27.5) 13% (4.6) 8% (2.8) match
arb_Arab lang 4.8 6.8 24.8 ×5.20 ×3.66 ×1.00 3% (1.2) 69% (27.5) 8% (3.4) 20% (7.9) match
ben_Beng lang 6.9 10.1 34.7 ×5.05 ×3.43 ×1.00 4% (1.2) 67% (19.2) 10% (2.8) 19% (5.3) match
cmn_Hani lang 4.7 7.4 18.7 ×4.00 ×2.53 ×1.00 2% (1.2) 70% (37.4) 11% (5.9) 17% (8.8) match
ell_Grek lang 4.3 5.9 23.7 ×5.51 ×4.02 ×1.00 3% (1.2) 68% (28.6) 8% (3.4) 21% (8.7) match
eng_Latn lang 5.2 8.0 18.4 ×3.51 ×2.28 ×1.00 5% (2.5) 71% (38.5) 8% (4.3) 16% (8.7) match
heb_Hebr lang 4.9 7.0 19.9 ×4.08 ×2.83 ×0.99 2% (1.2) 76% (37.7) 6% (3.1) 15% (7.6) match
hin_Deva lang 7.5 11.7 27.6 ×3.68 ×2.35 ×1.01 3% (1.2) 74% (26.7) 9% (3.2) 14% (5.0) match
jpn_Jpan lang 5.2 7.6 27.2 ×5.26 ×3.56 ×1.00 3% (1.2) 64% (23.3) 13% (4.7) 20% (7.4) match
kat_Geor lang 7.0 10.0 28.4 ×4.09 ×2.85 ×1.01 3% (1.2) 71% (26.2) 8% (3.1) 17% (6.4) match
kor_Hang lang 2.8 3.6 17.6 ×6.36 ×4.91 ×1.00 2% (1.2) 62% (34.9) 13% (7.3) 23% (12.7) match
rus_Cyrl lang 4.1 5.5 23.7 ×5.72 ×4.29 ×1.00 3% (1.2) 66% (27.6) 7% (2.9) 24% (10.2) match
tam_Taml lang 7.8 11.9 38.4 ×4.89 ×3.24 ×1.00 4% (1.2) 72% (18.6) 9% (2.4) 14% (3.7) match
tha_Thai lang 9.2 13.7 33.5 ×3.64 ×2.45 ×1.01 4% (1.2) 83% (24.7) 7% (2.2) 5% (1.6) match
added_normalized_dense modalities 7.7 12.9 20.7 ×2.70 ×1.60 ×1.05 3% (1.3) 85% (40.4) 10% (4.8) 2% (1.0) match
added_normalized_sparse modalities 6.3 9.9 18.9 ×3.01 ×1.91 ×1.03 4% (1.9) 76% (39.9) 12% (6.1) 8% (4.3) match
added_special_dense modalities 7.4 13.2 44.9 ×6.10 ×3.41 ×1.18 23% (5.0) 42% (9.1) 28% (6.0) 6% (1.4) match
added_special_sparse modalities 5.5 9.4 22.5 ×4.06 ×2.40 ×1.05 9% (3.8) 64% (27.8) 16% (7.0) 12% (5.1) match
agentic-traces modalities 4.9 7.5 18.1 ×3.73 ×2.42 ×1.00 4% (2.4) 70% (38.5) 9% (5.0) 16% (9.1) match
agentic_swe modalities 5.2 7.9 19.4 ×3.74 ×2.44 ×1.00 4% (1.9) 75% (38.6) 7% (3.8) 13% (6.9) match
code_mixed modalities 4.9 7.3 19.0 ×3.89 ×2.59 ×1.00 4% (2.2) 73% (38.4) 8% (4.2) 15% (7.6) match
math_latex modalities 4.8 7.4 18.2 ×3.76 ×2.46 ×1.00 4% (2.4) 70% (38.4) 9% (4.8) 16% (9.0) match
deepseek-v4 — deepseek 3-regex split-heavy byte-level BPE · ×3.76 vs v0.23.1 · ×2.05 vs sebpop/upstream · ×1.01 vs base deepseek-v4 speedup deepseek-v4 stage decomposition deepseek-v4 thread scaling

Memory (RSS MB, load+encode): v0.23.1 76+0 (peak 76) · sebpop/upstream 78+2 (peak 80) · Pipeline 114+0 (peak 114)

Fixture Group v0.23.1 MB/s sebpop/upstream MB/s Pipeline MB/s vs v0.23.1 vs sebpop/upstream Δ base added-token normalize pre-tokenize model Ids
amh_Ethi lang 6.6 7.1 33.9 ×5.16 ×4.80 ×1.01 2% (0.7) 0% (0.0) 17% (4.8) 81% (22.9) match
arb_Arab lang 4.9 8.2 17.1 ×3.49 ×2.09 ×1.02 1% (0.6) 0% (0.0) 6% (3.4) 93% (53.9) match
ben_Beng lang 5.9 9.5 18.5 ×3.15 ×1.94 ×1.00 1% (0.6) 0% (0.0) 6% (3.2) 93% (49.8) match
cmn_Hani lang 4.4 3.8 17.1 ×3.86 ×4.48 ×1.01 1% (0.8) 0% (0.0) 6% (3.2) 93% (52.9) match
ell_Grek lang 5.1 8.7 18.6 ×3.64 ×2.12 ×1.04 1% (0.7) 0% (0.0) 6% (3.5) 93% (50.7) match
eng_Latn lang 4.0 8.6 13.1 ×3.28 ×1.52 ×1.02 3% (2.0) 0% (0.0) 7% (5.0) 91% (68.4) match
heb_Hebr lang 4.3 6.7 13.2 ×3.04 ×1.96 ×1.02 1% (0.6) 0% (0.0) 5% (3.6) 94% (69.9) match
hin_Deva lang 6.0 11.1 21.9 ×3.65 ×1.98 ×1.01 1% (0.6) 0% (0.0) 8% (3.4) 91% (41.0) match
jpn_Jpan lang 5.0 4.6 18.5 ×3.70 ×4.04 ×1.00 1% (0.7) 0% (0.0) 6% (3.0) 93% (48.7) match
kat_Geor lang 6.1 5.6 17.9 ×2.93 ×3.21 ×1.00 1% (0.6) 0% (0.0) 5% (3.0) 93% (51.8) match
kor_Hang lang 4.8 5.6 20.2 ×4.23 ×3.59 ×1.02 1% (0.6) 0% (0.0) 8% (3.9) 91% (45.6) match
rus_Cyrl lang 4.9 3.7 15.0 ×3.06 ×4.02 ×1.03 1% (0.6) 0% (0.0) 5% (3.3) 94% (61.7) match
tam_Taml lang 6.3 7.0 18.5 ×2.93 ×2.65 ×1.01 1% (0.6) 0% (0.0) 5% (2.8) 94% (51.9) match
tha_Thai lang 6.5 4.5 15.0 ×2.32 ×3.36 ×1.00 1% (0.7) 0% (0.0) 3% (2.3) 96% (64.0) match
added_normalized_dense modalities 5.8 39.0 23.5 ×4.05 ×0.60 ×1.01 2% (0.8) 0% (0.0) 7% (2.8) 92% (38.5) match
added_normalized_sparse modalities 5.4 32.8 19.8 ×3.67 ×0.60 ×1.01 3% (1.4) 0% (0.0) 7% (3.8) 90% (45.4) match
added_special_dense modalities 4.5 12.1 36.5 ×8.08 ×3.01 ×1.02 24% (6.3) 1% (0.3) 24% (6.3) 50% (13.2) match
added_special_sparse modalities 4.6 17.1 20.6 ×4.45 ×1.21 ×1.01 8% (3.9) 0% (0.1) 14% (6.7) 78% (37.3) match
agentic-traces modalities 3.6 10.5 14.4 ×4.04 ×1.38 ×1.01 3% (1.8) 0% (0.0) 8% (5.4) 90% (63.6) match
agentic_swe modalities 3.3 11.9 15.0 ×4.51 ×1.26 ×0.99 2% (1.3) 0% (0.0) 6% (3.9) 92% (60.2) match
code_mixed modalities 3.7 12.8 15.4 ×4.18 ×1.20 ×0.99 2% (1.6) 0% (0.0) 7% (4.6) 90% (56.9) match
math_latex modalities 3.6 9.6 14.1 ×3.91 ×1.46 ×1.00 3% (1.9) 0% (0.0) 7% (5.4) 90% (65.1) match

Pre-tokenize: classify + fsm vs regex engines — ns/byte, lower better. The fsm is the scalar jump-table in both pipe columns; SIMD / scalar is the classify pass (regex pre-tokenizers have no SIMD fsm). ×vs = engine ÷ our pipeline (SIMD / scalar classify); onig & pcre2 (JIT) are C, fancy is pure-Rust fancy-regex, logos is a compile-time DFA lexer (approximate grammar; n/a for deepseek).

Fixture classify SIMD classify scalar pipe (SIMD cls + fsm) pipe (scalar cls + fsm) onig fancy pcre2 logos ×vs onig ×vs fancy ×vs pcre2 ×vs logos
amh_Ethi 2.64 3.44 4.78 5.58 42.2 20.0 9.3 8.8× / 7.6× 4.2× / 3.6× 2.0× / 1.7×
arb_Arab 1.00 3.03 3.44 5.47 49.1 22.3 10.2 14.2× / 9.0× 6.5× / 4.1× 3.0× / 1.9×
ben_Beng 1.46 2.94 3.20 4.67 35.7 15.6 7.6 11.1× / 7.6× 4.9× / 3.3× 2.4× / 1.6×
cmn_Hani 1.12 2.28 3.17 4.33 58.6 32.4 14.1 18.5× / 13.5× 10.2× / 7.5× 4.4× / 3.2×
ell_Grek 0.59 2.99 3.45 5.86 47.0 20.7 9.7 13.6× / 8.0× 6.0× / 3.5× 2.8× / 1.7×
eng_Latn 0.10 1.48 5.04 6.42 67.7 37.6 16.4 13.4× / 10.5× 7.5× / 5.9× 3.2× / 2.5×
heb_Hebr 1.00 3.07 3.63 5.71 51.3 23.2 10.7 14.1× / 9.0× 6.4× / 4.1× 2.9× / 1.9×
hin_Deva 1.36 3.09 3.38 5.11 37.8 17.9 8.7 11.2× / 7.4× 5.3× / 3.5× 2.6× / 1.7×
jpn_Jpan 1.56 3.35 2.98 4.76 52.5 26.3 11.7 17.6× / 11.0× 8.8× / 5.5× 3.9× / 2.5×
kat_Geor 1.39 2.55 3.02 4.18 31.9 14.7 7.3 10.6× / 7.6× 4.9× / 3.5× 2.4× / 1.7×
kor_Hang 1.08 2.85 3.90 5.67 48.9 25.9 11.8 12.5× / 8.6× 6.7× / 4.6× 3.0× / 2.1×
rus_Cyrl 1.03 2.93 3.33 5.23 46.2 19.8 9.5 13.9× / 8.8× 5.9× / 3.8× 2.9× / 1.8×
tam_Taml 0.92 2.94 2.78 4.80 31.5 13.2 6.6 11.3× / 6.6× 4.8× / 2.8× 2.4× / 1.4×
tha_Thai 1.36 2.58 2.32 3.54 27.2 9.9 5.4 11.7× / 7.7× 4.3× / 2.8× 2.3× / 1.5×
added_normalized_dense 0.06 1.47 2.79 4.20 41.7 19.3 9.3 15.0× / 9.9× 6.9× / 4.6× 3.3× / 2.2×
added_normalized_sparse 0.06 1.48 3.77 5.18 48.3 25.3 11.8 12.8× / 9.3× 6.7× / 4.9× 3.1× / 2.3×
added_special_dense 0.06 1.47 6.33 7.75 169.5 95.0 38.0 26.8× / 21.9× 15.0× / 12.3× 6.0× / 4.9×
added_special_sparse 0.06 1.48 6.74 8.16 107.9 55.0 23.9 16.0× / 13.2× 8.2× / 6.7× 3.5× / 2.9×
agentic-traces 0.59 1.48 5.35 6.25 84.2 49.5 19.9 15.7× / 13.5× 9.3× / 7.9× 3.7× / 3.2×
agentic_swe 0.51 1.44 3.85 4.78 101.2 61.8 23.3 26.3× / 21.2× 16.0× / 12.9× 6.0× / 4.9×
code_mixed 0.07 1.45 4.65 6.03 77.4 50.3 18.5 16.6× / 12.8× 10.8× / 8.3× 4.0× / 3.1×
math_latex 0.57 1.49 5.37 6.29 82.4 48.0 19.3 15.3× / 13.1× 8.9× / 7.6× 3.6× / 3.1×
gpt2 — gpt2 ByteLevel regex · ×6.40 vs v0.23.1 · ×0.91 vs sebpop/upstream · ×1.00 vs base gpt2 speedup gpt2 stage decomposition gpt2 thread scaling

Memory (RSS MB, load+encode): v0.23.1 20+13 (peak 34) · sebpop/upstream 27+1 (peak 28) · Pipeline 39+2 (peak 41)

Fixture Group v0.23.1 MB/s sebpop/upstream MB/s Pipeline MB/s vs v0.23.1 vs sebpop/upstream Δ base added-token normalize pre-tokenize model Ids
amh_Ethi lang 6.4 39.1 44.1 ×6.84 ×1.13 ×1.04 3% (0.7) 0% (0.0) 17% (3.6) 80% (17.1) match
arb_Arab lang 4.8 26.4 26.8 ×5.63 ×1.01 ×1.02 2% (0.6) 0% (0.0) 6% (2.2) 92% (33.5) match
ben_Beng lang 4.0 51.8 46.1 ×11.53 ×0.89 ×1.05 3% (0.6) 0% (0.0) 15% (3.0) 83% (17.2) match
cmn_Hani lang 5.0 18.4 29.2 ×5.86 ×1.59 ×1.00 2% (0.6) 0% (0.0) 7% (2.3) 91% (30.1) match
ell_Grek lang 4.9 24.7 28.8 ×5.84 ×1.17 ×0.96 2% (0.6) 0% (0.0) 6% (2.2) 92% (31.1) match
eng_Latn lang 4.2 12.9 14.0 ×3.34 ×1.09 ×0.98 3% (2.0) 0% (0.0) 4% (3.0) 93% (64.9) match
heb_Hebr lang 4.8 13.9 28.7 ×6.01 ×2.06 ×0.98 2% (0.6) 0% (0.0) 7% (2.3) 92% (31.1) match
hin_Deva lang 4.5 54.7 40.2 ×8.89 ×0.74 ×1.00 3% (0.6) 0% (0.0) 13% (3.1) 84% (20.0) match
jpn_Jpan lang 5.1 14.7 22.6 ×4.44 ×1.53 ×1.03 1% (0.6) 0% (0.0) 5% (2.1) 94% (40.6) match
kat_Geor lang 6.0 59.8 73.6 ×12.19 ×1.23 ×1.01 5% (0.6) 0% (0.0) 16% (2.1) 80% (10.3) match
kor_Hang lang 4.7 29.8 43.1 ×9.19 ×1.44 ×1.00 3% (0.6) 0% (0.0) 11% (2.4) 86% (18.9) match
rus_Cyrl lang 5.0 19.9 27.9 ×5.61 ×1.40 ×1.06 2% (0.6) 0% (0.0) 6% (2.1) 92% (32.4) match
tam_Taml lang 3.6 51.5 67.1 ×18.50 ×1.30 ×1.02 4% (0.6) 0% (0.0) 19% (2.7) 77% (10.9) match
tha_Thai lang 4.5 31.7 35.5 ×7.84 ×1.12 ×0.99 2% (0.6) 0% (0.0) 9% (2.5) 89% (24.2) match
added_normalized_dense modalities 5.3 113.5 26.4 ×5.01 ×0.23 ×1.01 2% (0.8) 0% (0.0) 3% (1.1) 95% (34.3) match
added_normalized_sparse modalities 5.1 90.5 21.9 ×4.33 ×0.24 ×0.98 3% (1.4) 0% (0.0) 4% (1.9) 93% (40.5) match
added_special_dense modalities 6.1 38.1 47.8 ×7.85 ×1.26 ×1.04 25% (5.0) 0% (0.0) 20% (4.0) 55% (11.1) ≠ sebpop/upstream
added_special_sparse modalities 5.2 54.2 23.8 ×4.61 ×0.44 ×1.01 8% (3.2) 0% (0.0) 11% (4.4) 81% (33.0) ≠ sebpop/upstream
agentic-traces modalities 3.6 20.7 16.3 ×4.49 ×0.79 ×0.99 3% (1.8) 0% (0.0) 6% (3.5) 91% (55.2) match
agentic_swe modalities 3.8 27.9 24.2 ×6.33 ×0.87 ×0.98 3% (1.3) 0% (0.0) 6% (2.3) 91% (35.8) match
code_mixed modalities 3.8 48.1 20.3 ×5.40 ×0.42 ×0.98 3% (1.6) 0% (0.0) 6% (2.8) 91% (43.6) match
math_latex modalities 3.8 17.0 15.2 ×4.04 ×0.90 ×0.99 3% (1.9) 0% (0.0) 5% (3.3) 92% (58.4) match

Pre-tokenize: classify + fsm vs regex engines — ns/byte, lower better. The fsm is the scalar jump-table in both pipe columns; SIMD / scalar is the classify pass (regex pre-tokenizers have no SIMD fsm). ×vs = engine ÷ our pipeline (SIMD / scalar classify); onig & pcre2 (JIT) are C, fancy is pure-Rust fancy-regex, logos is a compile-time DFA lexer (approximate grammar; n/a for deepseek).

Fixture classify SIMD classify scalar pipe (SIMD cls + fsm) pipe (scalar cls + fsm) onig fancy pcre2 logos ×vs onig ×vs fancy ×vs pcre2 ×vs logos
amh_Ethi 2.64 3.41 3.61 4.38 27.6 20.6 5.9 4.8 7.7× / 6.3× 5.7× / 4.7× 1.6× / 1.3× 1.3× / 1.1×
arb_Arab 1.00 3.01 2.23 4.25 32.6 25.0 7.0 5.2 14.6× / 7.7× 11.2× / 5.9× 3.1× / 1.6× 2.3× / 1.2×
ben_Beng 1.47 2.91 3.02 4.46 67.8 53.8 14.6 4.1 22.5× / 15.2× 17.8× / 12.0× 4.8× / 3.3× 1.4× / 0.9×
cmn_Hani 1.12 2.27 2.31 3.46 26.2 20.2 6.0 2.4 11.3× / 7.6× 8.7× / 5.8× 2.6× / 1.7× 1.0× / 0.7×
ell_Grek 0.59 3.05 2.16 4.62 28.7 21.4 6.1 4.7 13.3× / 6.2× 9.9× / 4.6× 2.8× / 1.3× 2.2× / 1.0×
eng_Latn 0.10 1.46 2.98 4.34 45.0 41.1 12.5 3.8 15.1× / 10.4× 13.8× / 9.5× 4.2× / 2.9× 1.3× / 0.9×
heb_Hebr 1.01 3.11 2.25 4.36 32.2 25.6 7.0 3.1 14.3× / 7.4× 11.4× / 5.9× 3.1× / 1.6× 1.4× / 0.7×
hin_Deva 1.36 3.08 3.10 4.81 63.4 54.4 13.9 4.3 20.5× / 13.2× 17.6× / 11.3× 4.5× / 2.9× 1.4× / 0.9×
jpn_Jpan 1.55 3.40 2.11 3.96 23.5 16.9 5.1 3.9 11.1× / 5.9× 8.0× / 4.3× 2.4× / 1.3× 1.8× / 1.0×
kat_Geor 1.46 2.57 2.05 3.15 17.7 13.9 4.3 2.1 8.6× / 5.6× 6.8× / 4.4× 2.1× / 1.3× 1.0× / 0.7×
kor_Hang 1.09 2.74 2.42 4.08 32.3 27.2 7.6 3.6 13.3× / 7.9× 11.2× / 6.7× 3.1× / 1.9× 1.5× / 0.9×
rus_Cyrl 1.02 2.96 2.08 4.03 27.4 20.8 5.9 2.5 13.1× / 6.8× 10.0× / 5.2× 2.8× / 1.5× 1.2× / 0.6×
tam_Taml 0.93 2.93 2.72 4.72 70.9 57.4 14.7 3.8 26.0× / 15.0× 21.1× / 12.2× 5.4× / 3.1× 1.4× / 0.8×
tha_Thai 1.36 2.62 2.47 3.73 40.4 31.1 8.9 3.2 16.3× / 10.8× 12.6× / 8.3× 3.6× / 2.4× 1.3× / 0.9×
added_normalized_dense 0.06 1.48 1.05 2.47 23.9 22.2 6.2 2.0 22.7× / 9.7× 21.1× / 9.0× 5.9× / 2.5× 1.9× / 0.8×
added_normalized_sparse 0.06 1.47 1.90 3.31 31.7 30.1 8.5 2.7 16.7× / 9.6× 15.9× / 9.1× 4.5× / 2.6× 1.4× / 0.8×
added_special_dense 0.06 1.47 4.04 5.45 95.3 93.9 20.5 3.1 23.6× / 17.5× 23.3× / 17.2× 5.1× / 3.8× 0.8× / 0.6×
added_special_sparse 0.06 1.47 4.44 5.86 62.2 58.6 14.6 3.4 14.0× / 10.6× 13.2× / 10.0× 3.3× / 2.5× 0.8× / 0.6×
agentic-traces 0.58 1.47 3.47 4.35 60.1 58.4 15.7 4.7 17.3× / 13.8× 16.9× / 13.4× 4.5× / 3.6× 1.4× / 1.1×
agentic_swe 0.56 1.45 2.34 3.23 61.3 64.8 14.9 3.6 26.2× / 19.0× 27.7× / 20.1× 6.4× / 4.6× 1.5× / 1.1×
code_mixed 0.07 1.46 2.80 4.19 60.2 63.5 15.6 4.1 21.5× / 14.4× 22.7× / 15.1× 5.6× / 3.7× 1.5× / 1.0×
math_latex 0.57 1.50 3.27 4.20 54.0 50.2 14.5 4.2 16.5× / 12.8× 15.4× / 11.9× 4.4× / 3.5× 1.3× / 1.0×
gpt-oss — o200k-regex byte-level BPE (gpt-oss) · ×5.04 vs v0.23.1 · ×1.94 vs sebpop/upstream · ×1.00 vs base gpt-oss speedup gpt-oss stage decomposition gpt-oss thread scaling

Memory (RSS MB, load+encode): v0.23.1 4+15 (peak 20) · sebpop/upstream 11+13 (peak 23) · Pipeline 20+0 (peak 20)

Fixture Group v0.23.1 MB/s sebpop/upstream MB/s Pipeline MB/s vs v0.23.1 vs sebpop/upstream Δ base added-token normalize pre-tokenize model Ids
amh_Ethi lang 6.9 18.6 61.4 ×8.86 ×3.30 ×0.97 4% (0.7) 0% (0.0) 31% (4.8) 65% (10.0) ≠ sebpop/upstream
arb_Arab lang 6.0 13.1 25.4 ×4.26 ×1.94 ×0.98 2% (0.6) 0% (0.0) 8% (3.3) 90% (34.9) match
ben_Beng lang 7.0 18.5 28.2 ×4.04 ×1.53 ×0.98 2% (0.6) 0% (0.0) 11% (3.7) 88% (30.3) match
cmn_Hani lang 7.1 12.2 38.3 ×5.40 ×3.14 ×0.99 2% (0.6) 0% (0.0) 14% (3.5) 84% (21.3) match
ell_Grek lang 6.2 14.7 32.1 ×5.19 ×2.18 ×0.98 2% (0.6) 0% (0.0) 10% (3.2) 88% (26.7) match
eng_Latn lang 5.1 11.1 21.7 ×4.29 ×1.96 ×1.01 5% (2.1) 0% (0.0) 10% (4.5) 86% (39.0) match
heb_Hebr lang 5.8 14.9 28.4 ×4.88 ×1.90 ×1.01 2% (0.6) 0% (0.0) 10% (3.4) 89% (30.7) match
hin_Deva lang 6.7 21.5 24.1 ×3.59 ×1.12 ×0.98 1% (0.6) 0% (0.0) 9% (3.8) 89% (36.2) match
jpn_Jpan lang 7.7 13.1 37.8 ×4.93 ×2.89 ×0.99 2% (0.6) 0% (0.0) 13% (3.3) 85% (21.9) match
kat_Geor lang 7.5 16.8 27.6 ×3.69 ×1.64 ×1.04 2% (0.6) 0% (0.0) 8% (2.8) 91% (32.4) match
kor_Hang lang 5.8 14.6 47.2 ×8.10 ×3.23 ×1.00 3% (0.6) 0% (0.0) 18% (3.7) 79% (16.1) match
rus_Cyrl lang 6.3 10.4 23.4 ×3.70 ×2.26 ×1.02 1% (0.6) 0% (0.0) 7% (3.1) 91% (38.3) match
tam_Taml lang 7.8 17.4 29.7 ×3.82 ×1.70 ×0.98 2% (0.6) 0% (0.0) 10% (3.2) 88% (29.1) match
tha_Thai lang 8.7 14.0 26.9 ×3.10 ×1.92 ×0.96 2% (0.6) 0% (0.0) 9% (3.3) 89% (32.4) match
added_normalized_dense modalities 6.6 33.7 46.1 ×7.02 ×1.37 ×1.00 4% (0.8) 0% (0.0) 10% (2.1) 86% (18.0) match
added_normalized_sparse modalities 6.3 30.1 37.1 ×5.86 ×1.23 ×1.01 5% (1.4) 0% (0.0) 12% (3.2) 83% (21.6) match
added_special_dense modalities 6.3 16.8 55.9 ×8.87 ×3.33 ×1.10 29% (4.8) 1% (0.2) 31% (5.2) 39% (6.7) match
added_special_sparse modalities 5.9 20.7 35.0 ×5.93 ×1.69 ×1.03 12% (3.2) 0% (0.1) 21% (5.8) 67% (18.5) match
agentic-traces modalities 4.7 14.0 22.7 ×4.84 ×1.63 ×0.99 4% (1.7) 0% (0.0) 12% (5.0) 84% (36.0) match
agentic_swe modalities 4.8 16.7 22.1 ×4.58 ×1.33 ×1.01 3% (1.3) 0% (0.0) 8% (3.7) 89% (39.7) match
code_mixed modalities 5.1 16.4 30.3 ×5.95 ×1.84 ×1.00 5% (1.5) 0% (0.0) 13% (4.3) 82% (26.6) match
math_latex modalities 4.7 13.0 23.0 ×4.85 ×1.77 ×1.00 4% (1.9) 0% (0.0) 11% (4.8) 84% (35.9) match

Pre-tokenize: classify + fsm vs regex engines — ns/byte, lower better. The fsm is the scalar jump-table in both pipe columns; SIMD / scalar is the classify pass (regex pre-tokenizers have no SIMD fsm). ×vs = engine ÷ our pipeline (SIMD / scalar classify); onig & pcre2 (JIT) are C, fancy is pure-Rust fancy-regex, logos is a compile-time DFA lexer (approximate grammar; n/a for deepseek).

Fixture classify SIMD classify scalar pipe (SIMD cls + fsm) pipe (scalar cls + fsm) onig fancy pcre2 logos ×vs onig ×vs fancy ×vs pcre2 ×vs logos
amh_Ethi 2.63 3.46 4.79 5.62 29.4 13.4 7.0 4.7 6.1× / 5.2× 2.8× / 2.4× 1.5× / 1.3× 1.0× / 0.8×
arb_Arab 1.00 3.05 3.28 5.33 35.8 15.0 7.7 5.0 10.9× / 6.7× 4.6× / 2.8× 2.3× / 1.4× 1.5× / 0.9×
ben_Beng 1.47 2.93 3.71 5.17 23.7 10.2 5.5 2.9 6.4× / 4.6× 2.7× / 2.0× 1.5× / 1.1× 0.8× / 0.6×
cmn_Hani 1.12 2.33 3.54 4.75 21.5 10.4 5.5 2.5 6.1× / 4.5× 2.9× / 2.2× 1.6× / 1.2× 0.7× / 0.5×
ell_Grek 0.58 3.05 3.19 5.65 29.7 14.0 6.8 5.1 9.3× / 5.3× 4.4× / 2.5× 2.1× / 1.2× 1.6× / 0.9×
eng_Latn 0.10 1.45 4.49 5.84 44.0 27.5 14.0 4.2 9.8× / 7.5× 6.1× / 4.7× 3.1× / 2.4× 0.9× / 0.7×
heb_Hebr 1.00 3.07 3.38 5.45 32.9 15.8 8.0 3.1 9.8× / 6.0× 4.7× / 2.9× 2.4× / 1.5× 0.9× / 0.6×
hin_Deva 1.37 3.12 3.79 5.55 26.5 12.0 6.4 3.2 7.0× / 4.8× 3.2× / 2.2× 1.7× / 1.2× 0.8× / 0.6×
jpn_Jpan 1.56 3.37 3.30 5.11 20.0 8.7 4.8 3.7 6.1× / 3.9× 2.6× / 1.7× 1.4× / 0.9× 1.1× / 0.7×
kat_Geor 1.39 2.62 2.80 4.03 19.0 9.4 4.5 2.1 6.8× / 4.7× 3.4× / 2.3× 1.6× / 1.1× 0.8× / 0.5×
kor_Hang 1.08 2.79 3.72 5.42 32.9 18.0 8.9 3.6 8.8× / 6.1× 4.8× / 3.3× 2.4× / 1.6× 1.0× / 0.7×
rus_Cyrl 1.02 2.96 3.09 5.03 28.3 13.8 6.5 4.9 9.2× / 5.6× 4.5× / 2.8× 2.1× / 1.3× 1.6× / 1.0×
tam_Taml 0.93 2.93 3.21 5.20 18.8 8.2 4.2 2.9 5.9× / 3.6× 2.6× / 1.6× 1.3× / 0.8× 0.9× / 0.6×
tha_Thai 1.37 2.58 3.29 4.51 13.3 5.5 2.8 2.3 4.0× / 2.9× 1.7× / 1.2× 0.9× / 0.6× 0.7× / 0.5×
added_normalized_dense 0.06 1.47 2.12 3.53 35.2 16.1 11.9 2.5 16.6× / 10.0× 7.6× / 4.6× 5.6× / 3.4× 1.2× / 0.7×
added_normalized_sparse 0.06 1.47 3.20 4.62 37.7 19.6 11.8 3.0 11.8× / 8.2× 6.1× / 4.2× 3.7× / 2.6× 0.9× / 0.7×
added_special_dense 0.06 1.48 5.21 6.63 85.4 65.3 24.6 3.4 16.4× / 12.9× 12.5× / 9.8× 4.7× / 3.7× 0.7× / 0.5×
added_special_sparse 0.06 1.47 5.76 7.17 56.2 38.4 16.6 3.6 9.8× / 7.8× 6.7× / 5.4× 2.9× / 2.3× 0.6× / 0.5×
agentic-traces 0.57 1.48 4.98 5.90 52.0 38.5 17.5 4.9 10.4× / 8.8× 7.7× / 6.5× 3.5× / 3.0× 1.0× / 0.8×
agentic_swe 0.56 1.44 3.71 4.59 54.9 46.1 17.7 3.6 14.8× / 12.0× 12.4× / 10.0× 4.8× / 3.8× 1.0× / 0.8×
code_mixed 0.07 1.44 4.35 5.72 55.1 43.4 17.7 4.3 12.7× / 9.6× 10.0× / 7.6× 4.1× / 3.1× 1.0× / 0.7×
math_latex 0.73 1.49 4.83 5.60 49.9 33.2 16.0 4.5 10.3× / 8.9× 6.9× / 5.9× 3.3× / 2.9× 0.9× / 0.8×
glm-5.2 — cl100k-variant regex byte-level BPE (glm-5.2) · ×8.20 vs v0.23.1 · ×2.48 vs sebpop/upstream · ×1.00 vs base glm-5.2 speedup glm-5.2 stage decomposition glm-5.2 thread scaling

Memory (RSS MB, load+encode): v0.23.1 2+26 (peak 28) · sebpop/upstream 11+25 (peak 36) · Pipeline 10+0 (peak 10)

Fixture Group v0.23.1 MB/s sebpop/upstream MB/s Pipeline MB/s vs v0.23.1 vs sebpop/upstream Δ base added-token normalize pre-tokenize model Ids
amh_Ethi lang 7.0 20.7 64.4 ×9.18 ×3.11 ×1.09 8% (1.2) 0% (0.0) 25% (3.7) 67% (9.8) match
arb_Arab lang 6.3 21.4 66.4 ×10.59 ×3.10 ×0.95 8% (1.2) 0% (0.0) 16% (2.3) 76% (10.9) match
ben_Beng lang 4.9 25.6 68.7 ×13.92 ×2.68 ×1.02 8% (1.2) 0% (0.0) 22% (3.1) 69% (9.6) match
cmn_Hani lang 7.6 17.0 69.2 ×9.15 ×4.06 ×1.02 9% (1.2) 0% (0.0) 17% (2.4) 74% (10.2) match
ell_Grek lang 6.5 21.1 73.5 ×11.28 ×3.48 ×1.01 9% (1.2) 0% (0.0) 17% (2.2) 74% (9.5) match
eng_Latn lang 5.1 11.0 23.4 ×4.57 ×2.13 ×1.01 6% (2.6) 0% (0.0) 7% (3.1) 87% (36.8) match
heb_Hebr lang 6.2 20.8 68.8 ×11.10 ×3.30 ×0.95 8% (1.2) 0% (0.0) 17% (2.3) 75% (10.3) match
hin_Deva lang 4.6 23.9 65.4 ×14.12 ×2.74 ×0.95 8% (1.2) 0% (0.0) 22% (3.2) 70% (10.2) match
jpn_Jpan lang 8.1 19.4 73.6 ×9.13 ×3.79 ×0.99 9% (1.2) 0% (0.0) 17% (2.2) 74% (9.5) match
kat_Geor lang 7.9 25.6 84.0 ×10.67 ×3.28 ×1.02 10% (1.2) 0% (0.0) 19% (2.1) 71% (8.0) match
kor_Hang lang 6.1 17.8 68.3 ×11.25 ×3.84 ×0.97 9% (1.2) 0% (0.0) 18% (2.5) 73% (10.2) match
rus_Cyrl lang 6.5 15.5 40.3 ×6.17 ×2.60 ×0.98 5% (1.2) 0% (0.0) 9% (2.2) 86% (20.9) match
tam_Taml lang 5.2 26.3 71.1 ×13.59 ×2.70 ×0.98 9% (1.2) 0% (0.0) 20% (2.7) 71% (9.5) match
tha_Thai lang 6.6 20.3 69.9 ×10.58 ×3.45 ×1.07 9% (1.2) 0% (0.0) 19% (2.5) 73% (9.9) match
added_normalized_dense modalities 7.0 40.5 47.8 ×6.78 ×1.18 ×1.02 7% (1.4) 0% (0.0) 5% (1.1) 88% (17.5) match
added_normalized_sparse modalities 6.6 32.0 41.6 ×6.33 ×1.30 ×1.03 8% (2.0) 0% (0.0) 8% (1.9) 84% (19.4) match
added_special_dense modalities 6.2 16.9 42.2 ×6.80 ×2.49 ×1.01 54% (12.2) 0% (0.0) 23% (5.3) 25% (5.7) match
added_special_sparse modalities 6.0 20.7 34.5 ×5.72 ×1.67 ×1.01 24% (6.6) 0% (0.0) 19% (5.4) 58% (16.2) match
agentic-traces modalities 4.7 13.8 24.3 ×5.23 ×1.77 ×1.01 6% (2.4) 0% (0.0) 9% (3.7) 85% (34.1) match
agentic_swe modalities 4.7 16.9 22.0 ×4.66 ×1.30 ×0.99 4% (1.9) 0% (0.0) 7% (2.8) 89% (38.9) match
code_mixed modalities 5.1 16.1 31.7 ×6.17 ×1.96 ×1.01 7% (2.2) 0% (0.0) 11% (3.4) 82% (25.0) match
math_latex modalities 4.8 12.6 24.9 ×5.19 ×1.97 ×1.01 6% (2.5) 0% (0.0) 9% (3.5) 85% (33.7) match

Pre-tokenize: classify + fsm vs regex engines — ns/byte, lower better. The fsm is the scalar jump-table in both pipe columns; SIMD / scalar is the classify pass (regex pre-tokenizers have no SIMD fsm). ×vs = engine ÷ our pipeline (SIMD / scalar classify); onig & pcre2 (JIT) are C, fancy is pure-Rust fancy-regex, logos is a compile-time DFA lexer (approximate grammar; n/a for deepseek).

Fixture classify SIMD classify scalar pipe (SIMD cls + fsm) pipe (scalar cls + fsm) onig fancy pcre2 logos ×vs onig ×vs fancy ×vs pcre2 ×vs logos
amh_Ethi 2.64 3.43 3.68 4.47 30.6 15.2 6.0 4.8 8.3× / 6.8× 4.1× / 3.4× 1.6× / 1.3× 1.3× / 1.1×
arb_Arab 1.00 3.05 2.31 4.36 35.1 17.8 6.7 5.1 15.2× / 8.0× 7.7× / 4.1× 2.9× / 1.5× 2.2× / 1.2×
ben_Beng 1.46 2.97 3.08 4.58 52.0 25.4 10.2 3.8 16.9× / 11.4× 8.3× / 5.6× 3.3× / 2.2× 1.2× / 0.8×
cmn_Hani 1.13 2.28 2.36 3.51 21.3 11.0 4.7 2.5 9.1× / 6.1× 4.7× / 3.1× 2.0× / 1.3× 1.1× / 0.7×
ell_Grek 0.59 3.06 2.20 4.67 31.7 16.4 6.1 4.7 14.4× / 6.8× 7.4× / 3.5× 2.8× / 1.3× 2.2× / 1.0×
eng_Latn 0.12 1.46 3.06 4.40 51.2 31.0 12.2 3.9 16.8× / 11.6× 10.1× / 7.0× 4.0× / 2.8× 1.3× / 0.9×
heb_Hebr 1.00 3.10 2.31 4.42 35.1 18.3 6.8 3.1 15.2× / 7.9× 7.9× / 4.1× 2.9× / 1.5× 1.3× / 0.7×
hin_Deva 1.36 3.11 3.19 4.93 54.7 28.2 11.2 4.0 17.2× / 11.1× 8.8× / 5.7× 3.5× / 2.3× 1.3× / 0.8×
jpn_Jpan 1.57 3.40 2.17 4.00 19.7 9.4 4.0 3.8 9.1× / 4.9× 4.3× / 2.3× 1.9× / 1.0× 1.8× / 1.0×
kat_Geor 1.40 2.57 2.09 3.26 19.1 10.6 4.1 2.0 9.1× / 5.9× 5.1× / 3.3× 2.0× / 1.3× 0.9× / 0.6×
kor_Hang 1.13 2.95 2.51 4.34 35.4 20.0 7.5 3.7 14.1× / 8.1× 7.9× / 4.6× 3.0× / 1.7× 1.5× / 0.8×
rus_Cyrl 1.02 3.03 2.16 4.17 30.0 15.9 5.9 2.5 13.9× / 7.2× 7.4× / 3.8× 2.7× / 1.4× 1.2× / 0.6×
tam_Taml 0.92 3.01 2.67 4.75 50.6 24.7 9.8 3.4 19.0× / 10.6× 9.3× / 5.2× 3.7× / 2.1× 1.3× / 0.7×
tha_Thai 1.37 2.56 2.53 3.73 31.5 15.3 6.7 3.0 12.4× / 8.4× 6.0× / 4.1× 2.6× / 1.8× 1.2× / 0.8×
added_normalized_dense 0.06 1.47 1.07 2.49 27.4 15.8 6.6 2.0 25.5× / 11.0× 14.7× / 6.3× 6.2× / 2.7× 1.8× / 0.8×
added_normalized_sparse 0.06 1.47 1.92 3.34 36.3 21.5 8.6 2.7 18.9× / 10.9× 11.2× / 6.5× 4.5× / 2.6× 1.4× / 0.8×
added_special_dense 0.06 1.47 5.27 6.69 110.1 69.8 20.8 3.3 20.9× / 16.5× 13.2× / 10.4× 3.9× / 3.1× 0.6× / 0.5×
added_special_sparse 0.06 1.47 5.40 6.82 70.5 42.7 15.1 3.7 13.1× / 10.3× 7.9× / 6.3× 2.8× / 2.2× 0.7× / 0.5×
agentic-traces 0.57 1.47 3.71 4.61 61.0 40.8 14.8 4.7 16.5× / 13.2× 11.0× / 8.8× 4.0× / 3.2× 1.3× / 1.0×
agentic_swe 0.53 1.45 2.85 3.76 63.6 46.5 15.4 3.5 22.3× / 16.9× 16.3× / 12.4× 5.4× / 4.1× 1.2× / 0.9×
code_mixed 0.07 1.45 3.35 4.73 61.0 44.3 15.2 4.1 18.2× / 12.9× 13.2× / 9.4× 4.5× / 3.2× 1.2× / 0.9×
math_latex 0.57 1.48 3.45 4.36 59.2 37.5 14.0 4.3 17.1× / 13.6× 10.9× / 8.6× 4.0× / 3.2× 1.2× / 1.0×
llama-2 — model-bounded BPE, no pre-tokenizer · ×2.78 vs v0.23.1 · ×0.98 vs base llama-2 speedup llama-2 stage decomposition llama-2 thread scaling

Memory (RSS MB, load+encode): v0.23.1 36+11 (peak 46) · sebpop/upstream — · Pipeline 41+0 (peak 41)

Fixture Group v0.23.1 MB/s sebpop/upstream MB/s Pipeline MB/s vs v0.23.1 vs sebpop/upstream Δ base added-token normalize pre-tokenize model Ids
amh_Ethi lang 7.2 46.9 ×6.54 ×0.99 0% (0.0) 15% (2.8) 0% (0.0) 85% (16.2) match
arb_Arab lang 14.6 51.3 ×3.52 ×0.96 0% (0.0) 18% (3.3) 0% (0.1) 82% (15.0) match
ben_Beng lang 16.3 85.0 ×5.23 ×0.93 0% (0.0) 20% (2.2) 0% (0.0) 79% (8.5) match
cmn_Hani lang 13.9 67.9 ×4.90 ×0.93 0% (0.1) 3% (0.4) 0% (0.0) 96% (12.1) match
ell_Grek lang 15.1 59.9 ×3.97 ×0.95 0% (0.0) 21% (3.2) 0% (0.0) 79% (12.0) match
eng_Latn lang 4.8 6.5 ×1.37 ×1.02 0% (0.1) 5% (6.8) 0% (0.1) 95% (142.4) match
heb_Hebr lang 14.7 63.3 ×4.29 ×0.95 0% (0.0) 23% (3.4) 0% (0.0) 76% (11.1) match
hin_Deva lang 17.1 81.0 ×4.74 ×0.97 0% (0.0) 26% (2.8) 1% (0.1) 74% (8.2) match
jpn_Jpan lang 19.1 87.8 ×4.59 ×0.93 1% (0.0) 4% (0.4) 0% (0.0) 96% (9.3) match
kat_Geor lang 20.7 93.8 ×4.52 ×0.94 0% (0.0) 20% (1.9) 0% (0.0) 79% (7.6) match
kor_Hang lang 10.3 54.0 ×5.24 ×0.95 0% (0.1) 20% (3.3) 0% (0.0) 80% (13.5) match
rus_Cyrl lang 9.7 16.4 ×1.70 ×0.98 0% (0.0) 5% (2.8) 0% (0.0) 95% (55.8) match
tam_Taml lang 18.7 95.7 ×5.12 ×0.98 0% (0.0) 19% (1.8) 0% (0.0) 81% (7.5) match
tha_Thai lang 23.1 88.7 ×3.83 ×0.94 0% (0.0) 10% (1.0) 0% (0.0) 90% (9.1) match
added_normalized_dense modalities 6.5 8.7 ×1.33 ×0.98 0% (0.0) 3% (4.0) 0% (0.0) 96% (109.9) match
added_normalized_sparse modalities 5.5 7.5 ×1.37 ×1.02 0% (0.0) 5% (6.1) 0% (0.0) 95% (120.0) match
added_special_dense modalities 8.2 21.0 ×2.57 ×1.03 10% (4.8) 31% (14.5) 2% (1.1) 56% (25.9) match
added_special_sparse modalities 10.2 10.7 ×1.05 ×1.02 2% (2.1) 13% (12.2) 1% (0.5) 84% (76.6) match
agentic-traces modalities 5.1 7.2 ×1.41 ×1.01 0% (0.1) 5% (6.2) 0% (0.0) 95% (128.7) match
agentic_swe modalities 4.5 7.5 ×1.65 ×1.00 0% (0.0) 8% (9.9) 0% (0.2) 92% (120.6) match
code_mixed modalities 4.7 7.2 ×1.53 ×0.99 0% (0.0) 6% (8.0) 0% (0.2) 94% (125.8) match
math_latex modalities 4.9 6.8 ×1.38 ×0.99 0% (0.1) 4% (6.4) 0% (0.0) 95% (135.3) match
llama-3 — cl100k-regex byte-level BPE (llama-3), single regex · ×5.58 vs v0.23.1 · ×2.41 vs sebpop/upstream · ×1.05 vs base llama-3 speedup llama-3 stage decomposition llama-3 thread scaling

Memory (RSS MB, load+encode): v0.23.1 174+0 (peak 175) · sebpop/upstream 178+0 (peak 179) · Pipeline 200+0 (peak 200)

Fixture Group v0.23.1 MB/s sebpop/upstream MB/s Pipeline MB/s vs v0.23.1 vs sebpop/upstream Δ base added-token normalize pre-tokenize model Ids
amh_Ethi lang 7.1 6.8 54.9 ×7.70 ×8.03 ×1.01 4% (0.7) 0% (0.0) 22% (3.7) 74% (12.3) match
arb_Arab lang 5.7 9.0 19.5 ×3.41 ×2.17 ×1.05 1% (0.6) 0% (0.0) 5% (2.3) 94% (46.8) match
ben_Beng lang 5.3 26.8 33.7 ×6.37 ×1.26 ×1.04 2% (0.6) 0% (0.0) 10% (3.1) 87% (25.5) match
cmn_Hani lang 6.3 4.4 18.7 ×2.99 ×4.23 ×1.07 1% (0.6) 0% (0.0) 5% (2.3) 94% (47.5) match
ell_Grek lang 6.2 9.1 21.1 ×3.42 ×2.31 ×1.03 1% (0.6) 0% (0.0) 5% (2.2) 94% (44.0) match
eng_Latn lang 6.2 23.7 47.4 ×7.66 ×2.00 ×1.08 11% (2.0) 0% (0.0) 17% (3.0) 72% (12.4) match
heb_Hebr lang 5.8 13.2 28.0 ×4.78 ×2.11 ×1.03 2% (0.6) 0% (0.0) 7% (2.3) 92% (31.6) match
hin_Deva lang 6.8 27.8 83.6 ×12.23 ×3.00 ×1.06 5% (0.6) 0% (0.0) 28% (3.2) 66% (7.5) match
jpn_Jpan lang 6.6 4.8 18.1 ×2.75 ×3.79 ×1.04 1% (0.6) 0% (0.0) 4% (2.2) 95% (50.2) match
kat_Geor lang 7.7 12.2 40.5 ×5.26 ×3.32 ×1.01 3% (0.6) 0% (0.0) 9% (2.1) 89% (20.8) match
kor_Hang lang 5.5 6.2 21.0 ×3.78 ×3.36 ×1.04 1% (0.6) 0% (0.0) 6% (2.5) 93% (42.2) match
rus_Cyrl lang 6.0 7.6 18.1 ×3.02 ×2.37 ×1.04 1% (0.6) 0% (0.0) 4% (2.1) 95% (50.4) match
tam_Taml lang 5.4 27.6 37.9 ×7.00 ×1.37 ×1.05 2% (0.6) 0% (0.0) 10% (2.6) 88% (23.0) match
tha_Thai lang 6.5 5.4 22.2 ×3.42 ×4.10 ×1.01 1% (0.6) 0% (0.0) 6% (2.5) 93% (40.1) match
added_normalized_dense modalities 6.9 41.6 28.7 ×4.17 ×0.69 ×1.03 2% (0.8) 0% (0.0) 3% (1.0) 95% (32.3) match
added_normalized_sparse modalities 7.3 35.3 45.9 ×6.27 ×1.30 ×1.04 7% (1.4) 0% (0.0) 9% (1.9) 85% (17.9) match
added_special_dense modalities 6.5 16.8 79.9 ×12.37 ×4.75 ×1.13 41% (4.9) 1% (0.2) 42% (5.0) 16% (1.9) match
added_special_sparse modalities 6.9 22.0 75.9 ×10.93 ×3.45 ×1.08 25% (3.2) 0% (0.0) 42% (5.2) 33% (4.1) match
agentic-traces modalities 5.5 20.1 39.3 ×7.14 ×1.95 ×1.06 8% (1.8) 0% (0.0) 16% (3.7) 76% (17.4) match
agentic_swe modalities 5.4 22.0 29.6 ×5.49 ×1.34 ×1.05 4% (1.3) 0% (0.0) 9% (2.8) 87% (27.2) match
code_mixed modalities 5.9 22.6 49.3 ×8.32 ×2.18 ×1.06 9% (1.6) 0% (0.0) 18% (3.3) 73% (12.8) match
math_latex modalities 5.5 21.1 42.3 ×7.66 ×2.00 ×1.06 9% (2.0) 0% (0.0) 17% (3.4) 74% (15.3) match

Pre-tokenize: classify + fsm vs regex engines — ns/byte, lower better. The fsm is the scalar jump-table in both pipe columns; SIMD / scalar is the classify pass (regex pre-tokenizers have no SIMD fsm). ×vs = engine ÷ our pipeline (SIMD / scalar classify); onig & pcre2 (JIT) are C, fancy is pure-Rust fancy-regex, logos is a compile-time DFA lexer (approximate grammar; n/a for deepseek).

Fixture classify SIMD classify scalar pipe (SIMD cls + fsm) pipe (scalar cls + fsm) onig fancy pcre2 logos ×vs onig ×vs fancy ×vs pcre2 ×vs logos
amh_Ethi 2.63 3.42 3.67 4.46 27.4 15.8 5.9 4.8 7.5× / 6.1× 4.3× / 3.5× 1.6× / 1.3× 1.3× / 1.1×
arb_Arab 1.01 3.08 2.30 4.37 31.4 18.6 6.7 5.1 13.6× / 7.2× 8.0× / 4.2× 2.9× / 1.5× 2.2× / 1.2×
ben_Beng 1.46 3.02 3.05 4.61 45.8 26.3 10.2 3.8 15.0× / 9.9× 8.6× / 5.7× 3.3× / 2.2× 1.2× / 0.8×
cmn_Hani 1.12 2.31 2.35 3.54 19.4 11.1 4.6 2.5 8.3× / 5.5× 4.7× / 3.1× 1.9× / 1.3× 1.1× / 0.7×
ell_Grek 0.58 3.00 2.19 4.61 28.6 16.2 6.1 4.8 13.1× / 6.2× 7.4× / 3.5× 2.8× / 1.3× 2.2× / 1.0×
eng_Latn 0.12 1.48 3.01 4.37 44.6 32.2 12.2 3.9 14.8× / 10.2× 10.7× / 7.4× 4.1× / 2.8× 1.3× / 0.9×
heb_Hebr 1.00 3.16 2.29 4.46 31.4 18.8 6.8 3.1 13.7× / 7.0× 8.2× / 4.2× 3.0× / 1.5× 1.3× / 0.7×
hin_Deva 1.37 3.13 3.18 4.94 49.2 30.3 11.1 4.1 15.5× / 10.0× 9.5× / 6.1× 3.5× / 2.2× 1.3× / 0.8×
jpn_Jpan 1.55 3.34 2.16 3.94 18.2 9.8 4.0 3.9 8.4× / 4.6× 4.5× / 2.5× 1.9× / 1.0× 1.8× / 1.0×
kat_Geor 1.39 2.51 2.08 3.20 17.2 10.8 4.2 2.0 8.3× / 5.4× 5.2× / 3.4× 2.0× / 1.3× 1.0× / 0.6×
kor_Hang 1.15 2.79 2.51 4.15 31.4 20.4 7.5 3.7 12.5× / 7.6× 8.1× / 4.9× 3.0× / 1.8× 1.5× / 0.9×
rus_Cyrl 1.03 3.00 2.14 4.11 27.0 16.2 5.8 2.4 12.6× / 6.6× 7.6× / 3.9× 2.7× / 1.4× 1.1× / 0.6×
tam_Taml 0.92 2.98 2.65 4.70 45.5 25.6 9.8 3.4 17.2× / 9.7× 9.7× / 5.4× 3.7× / 2.1× 1.3× / 0.7×
tha_Thai 1.36 2.56 2.51 3.72 28.3 15.5 6.7 3.0 11.3× / 7.6× 6.2× / 4.2× 2.7× / 1.8× 1.2× / 0.8×
added_normalized_dense 0.06 1.48 1.00 2.42 24.2 16.3 6.5 2.0 24.3× / 10.0× 16.4× / 6.7× 6.5× / 2.7× 2.0× / 0.8×
added_normalized_sparse 0.06 1.47 1.94 3.35 31.7 21.8 8.7 2.7 16.4× / 9.4× 11.3× / 6.5× 4.5× / 2.6× 1.4× / 0.8×
added_special_dense 0.06 1.47 4.95 6.37 96.4 70.7 21.0 3.3 19.5× / 15.1× 14.3× / 11.1× 4.2× / 3.3× 0.7× / 0.5×
added_special_sparse 0.06 1.48 5.19 6.61 61.6 43.7 14.8 3.7 11.9× / 9.3× 8.4× / 6.6× 2.8× / 2.2× 0.7× / 0.6×
agentic-traces 0.58 1.48 3.69 4.59 54.5 41.3 15.0 4.7 14.8× / 11.9× 11.2× / 9.0× 4.1× / 3.3× 1.3× / 1.0×
agentic_swe 0.66 1.44 2.83 3.61 56.1 48.4 15.4 3.5 19.9× / 15.6× 17.1× / 13.4× 5.5× / 4.3× 1.2× / 1.0×
code_mixed 0.07 1.44 3.26 4.63 53.8 50.5 15.0 4.1 16.5× / 11.6× 15.5× / 10.9× 4.6× / 3.2× 1.3× / 0.9×
math_latex 0.69 1.48 3.43 4.22 51.8 37.8 14.2 4.3 15.1× / 12.3× 11.0× / 9.0× 4.1× / 3.4× 1.2× / 1.0×
Not yet supported: t5-base
t5-base not supported

@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Bench the tokenizers crate from sebpop's performance branch
(github.com/sebpop/tokenizers#upstream) alongside the released 0.23.1
in the pipeline benchmark: single-thread throughput per fixture, the
multi-thread sweep, per-implementation memory footprint, minimal-binary
size, and a report-only id-diff flag. The charts keep a single vs-release
axis — sebpop renders as a second (green) bar next to the pipeline's.

The git dep uses sebpop's default features minus mimalloc: its override
feature would swap the global allocator for the whole bench process and
skew every series. Cargo.lock pins the resolved commit;
`cargo update tokenizers@0.22.3-dev.0` moves it to the branch tip.

Older cached bench JSONs (base-branch baselines) without the sebpop keys
still render unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Plain `encode` tracks offsets and silently bypasses sebpop's fused
byte-level fast path (gated on OffsetType::None behind encode_fast /
encode_batch_fast — the API his blog numbers measure). Switch both
references to `encode_fast`, the same offsets-free regime the
PipelineTokenizer plays in, so all three series answer the same
question.

New `bench-mimalloc` feature installs mimalloc as the bench binary's
global allocator — the allocator sebpop's branch ships by default —
uniformly for all three series, since one process can't give each
series its own allocator. CI enables it for the bench shards only
(not binsize: that chart measures the library, not the allocator).

Local gpt2 check (M3 Max, 18 fixtures): ids match across all three
implementations, fused path included; sebpop jumps from ~x1.5 to
~x7.3 geomean vs v0.23.1, landing within ~15% of the pipeline.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
sebpop/upstream@13699f62 guards transform_range for its no-offsets fast
path but not NormalizedString::replace, so encode_fast panics ("offset
data accessed on fast path") on any model with a Replace normalizer —
llama-2's Prepend+Replace killed bench shard 2. Probe under catch_unwind
and demote the series to None, the same fallback used for configs that
fail to load; charts render the model without a sebpop bar.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@ArthurZucker ArthurZucker left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants