Benchmarks

Performance comparison between PySET and PySBD.

Performance Summary

2-3x
Faster than PySBD
158K+
Words/Second
100%
52 Language Accuracy
Zero
Dependencies

Execution Time

Execution Time

Text SizeWordsPySETPySBDSpeedup
Sentences~50.05ms0.10ms2.0x
Paragraph~1040.60ms1.37ms2.3x
Article~4842.41ms5.25ms2.2x
Document~14005.68ms21.95ms3.9x

Words per Second

Words per Second

Accuracy

MetricPySETPySBD
52 Languages100%100%
Legal DocumentsBetterOver-splits

Key Findings

  • PySET is 2-3x faster than PySBD across all text sizes
  • Speedup increases with text size (up to 3.9x on documents)
  • PySET is more accurate on legal documents (no false splits at commas)
  • 100% accuracy on 52 languages

Optimizations

  • Context Caching - ~5x speedup
  • Early Exit Strategy - ~3x speedup
  • Pre-compiled Patterns - One-time compilation

Run Your Own Benchmark

from pyset import TokenBoundaryDetector
import time

detector = TokenBoundaryDetector()
text = "Your text here. Add more sentences. More text."

start = time.perf_counter()
sentences = detector.split(text)
elapsed = time.perf_counter() - start

words_per_sec = len(text.split()) / elapsed
print(f"Time: {elapsed*1000:.2f}ms")
print(f"Rate: {words_per_sec:,.0f} words/sec")