Compact benchmark CI + non-UTF-8 detection fix - #62
Merged
Merged
Conversation
Same features as PR #58 with a smaller footprint: - Consolidate the benchmark harness from three scripts (benchmark.py, run.py, compare.py) into a single bench.py with `run` and `compare` subcommands. `run --supervise` folds in the subprocess crash-capture, so the extra wrapper file is gone and arg-parsing / version() / _decode_equivalent are shared instead of duplicated. - Compact benchmark.yml: loop over the three venvs instead of repeating each command, drop the duplicated SHA-256 check (kept once, always), hoist the corpus digest into an env var, and condense the rationale comments. - Trim redundant module/test docstrings that repeated the shared context. The native change (UTF-8 fast path + chunked handle_data in _cchardet.pyx, the encoding-only nsMBCSGroupProber overlay, meson wiring) and its regression tests are carried over unchanged. Full suite: 130 passed, 1 skipped; live benchmark + compare pipeline verified end to end. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014Zv2D1piziEpiwLMF2G1Cc
This was referenced Aug 3, 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.
Summary
A more compact take on the features from #58 — same behavior and all shipped detection logic, with a smaller footprint: 1341 → 1297 added lines, 10 → 8 files changed.
What changed
Benchmark tooling (real redundancy — no risk to the library):
benchmark.py+run.py+compare.py(349 lines, 3 files) →benchmarks/bench.py(331 lines, 1 file) withrunandcomparesubcommands.run.py's subprocess crash-capture is nowrun --supervise, andparse_args/version()/_decode_equivalentare shared instead of triplicated.cchardetis imported lazily insiderun, socomparestill runs in the base CI Python without it installed.benchmark.yml. Loops over the three venvs instead of repeating each command six times, hoists the corpus SHA-256 into a workflow env var, and drops a duplicated integrity check (kept once, in the always-run verify step). Every other step is unchanged.make_nonutf8_corpus.pyandtest_nonutf8_detection.pythat restated shared context — the issue references (BUG: Incorrect Encoding Detection as Big5 #33 / Fix/pr37 artifact actions v4 #38 / Performance regression with 3.x #57), pickle-format description, decode-equivalence rationale, and threshold reasoning are all preserved.Carried over unchanged (correctness-critical, deliberately not "compacted"): the
_cchardet.pyxUTF-8 fast path + chunkedhandle_data, thensMBCSGroupProberencoding-only overlay,meson.build, and the regression tests.Validation
run/run --supervise/comparepipeline on the generated corpus: UTF-8 mislabel rate 0.0%, table + gates render correctly, exit codes correct.version()helper reports"unknown"instead of raising if package metadata is ever missing — which cannot occur in CI (every venv hasfaust-cchardetinstalled).Notes
The bulk of the diff is the ~470-line native overlay (mostly license header + necessary detection logic), which I left intact rather than trade line count for detection-correctness risk. Further raw-size reductions would mean dropping overlapping features (e.g. the
github-action-benchmarkcontinuous check vs. the customcomparegate, or the CI non-UTF-8 benchmark vs. the unit tests) — happy to do that if wanted, but those are scope calls.🤖 Generated with Claude Code
Generated by Claude Code