ci: add competitive CodSpeed benchmarks vs pySBD and punkt - #71
Merged
Merged
Conversation
Add benchmarks/test_competitive_codspeed.py comparing sentencesplit's per-call latency and a throughput-proxy against pySBD (the rule-based library it derives from) and nltk's punkt. All three are pure Python, so CodSpeed's instruction-count measurement compares them fairly; C/Cython tokenizers are intentionally excluded. Each engine is constructed once in a fixture so only steady-state segmentation is timed. Adds pysbd + nltk to the isolated bench group and a punkt-model download step (run outside CodSpeed instrumentation), and runs the new file alongside the existing latency benchmarks.
Merging this PR will not alter performance
Performance Changes
Comparing |
yisding
marked this pull request as ready for review
June 14, 2026 01:27
This was referenced Jun 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
benchmarks/test_competitive_codspeed.py— CodSpeed benchmarks comparing sentencesplit's per-call latency and a throughput proxy against pySBD (the rule-based library it derives from) and punkt (nltk's statistical tokenizer), and wires it into the existing CodSpeed workflow.pysbd+nltkadded to the isolatedbenchgroup (both pure Python).segment× {short, medium, large} × {ours, pysbd, punkt} +throughput× 3.Why only these two peers
CodSpeed's instrumentation mode measures CPU instructions, a fair proxy for wall-clock only among libraries of the same execution character. All three here are pure Python → apples-to-apples. C/Cython tokenizers (spaCy, blingfire, stanza) would have a wildly different instruction-to-wallclock ratio and are intentionally excluded — use a wall-clock harness (the
compare-segmentersskill) for those.Reading the results
CodSpeed compares each benchmark to itself across commits, not library-to-library, so the three engines are compared by reading their absolute numbers side-by-side in the dashboard (the
[size-ours]/[size-pysbd]/[size-punkt]rows). The per-PR delta still guards each engine against regression.Honest preview (local walltime — directional, CI instruction-count will differ)
Takeaways, unspun:
Isolation / safety
tests/only — never collects these files or installs pysbd/nltk into the test matrix.https://claude.ai/code/session_01RBqMKEGgvcZEAXLTPP5FiV
Generated by Claude Code