Sp

Splintr – Rust BPE tokenizer, 12x faster than tiktoken for batches

Hacker News

Splintr – Rust BPE tokenizer, 12x faster than tiktoken for batches

Hi HN, I built Splintr, a BPE tokenizer in Rust (with Python bindings), because I found existing Python-based tokenizers were bottlenecking my data processing pipelines. While OpenAI's tiktoken is the gold standard for correctness, I found I could get significantly better throughput on modern multi-core CPUs by rethinking how parallelism is applied. Splintr achieves ~111 MB/s batch throughput (vs ~9 MB/s for tiktoken). The Design Choice: "Sequential by Default" One of the most interesting findings during development was that naive parallelism actually hurts performance for typical LLM inputs. Thread pool overhead is significant for texts under 1MB. I implemented a hybrid strategy: Single Text (encode): Purely sequential. It’s 3-4x faster than tiktoken simply by using pcre2 with JIT instead of standard regex handling. Batch Processing (encode_batch): Parallelizes across texts using Rayon, rather than within a text. This saturates all cores without the overhead of splitting small strings. Other Features: Safety: Strict UTF-8 compliance, including a streaming decoder that correctly buffers incomplete multi-byte characters. Compatibility: Drop-in support for cl100k_base (GPT-4), o200k_base (GPT-4o), and llama3 vocabularies. The repo is written in Rust with PyO3 bindings. I’d love feedback on the implementation or other potential optimization tricks for BPE. Thanks!

Share card

Actual performance

1points
Did not reach leaderboard

Launch Intel predictions

Analyze your own launch →
Indie HackersFits the IH revenue-focused audience · Strong signals: para, including · Missing: supports, reddit linkedin, podcasting
77%77% predicted probability of success on Indie Hackers, based on ML models trained on real launch data.
best fitHighest predicted score across all platforms for this description.
AppSumoStrong fit for a featured deal · Missing: plus, platform, intuitive
60%60% predicted probability of success on AppSumo, based on ML models trained on real launch data.
Product HuntOn track for Day 1 leaderboard · Strong signals: openai, single, using · Missing: mac, agents, macos
60%60% predicted probability of success on Product Hunt, based on ML models trained on real launch data.
Hacker NewsStrong engagement from HN community · Strong signals: exist, existing, llama · Missing: https docs, excited, just released
56%56% predicted probability of success on Hacker News, based on ML models trained on real launch data.
nativeThis product was originally launched on this platform.
TrustMRRLess likely to generate early MRR · Strong signals: para · Missing: mobile apps, ios, personal
49%49% predicted probability of success on TrustMRR, based on ML models trained on real launch data.
Acquire.comPre-revenue stage for this audience · Missing: arr, mrr, revenue
20%20% predicted probability of success on Acquire.com, based on ML models trained on real launch data.
BetaListMay not resonate with beta-testers · Missing: web3, chat, crypto
2%2% predicted probability of success on BetaList, based on ML models trained on real launch data.

Incorrect prediction on native model

Similar products

Wi
WisniaLang – Compile binaries 41x faster and 27x lighter than Rust58%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

WisniaLang – Compile binaries 41x faster and 27x lighter than Rust

Hacker News1
Wo
Wordchipper – Rust BPE tokenizer, 9x faster than tiktoken67%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Wordchipper – Rust BPE tokenizer, 9x faster than tiktoken

Hacker News2
A
A faster fuck (thefuck CLI rewritten in Rust)58%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

A faster fuck (thefuck CLI rewritten in Rust)

Hacker News2
St
StatsD in Rust51%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

StatsD in Rust

Hacker News1
TF
TF-IDF in Rust51%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

TF-IDF in Rust

Hacker News1
Ru
Rust FFI in a Wireshark C dissector51%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Rust FFI in a Wireshark C dissector

Hacker News1
Ru
Rust-wasm-webpack50%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Rust-wasm-webpack

Hacker News6
Sc
Screencast: An Introduction to Rust57%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Screencast: An Introduction to Rust

Hacker News3
Ha
Handlebars for Rust51%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Handlebars for Rust

Hacker News2
Ox
Oxischeme – A Scheme implementation in Rust56%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Oxischeme – A Scheme implementation in Rust

Hacker News18