Repository navigation
ci: add benchmark workflow - #33
Conversation
Cases: - decode windows-1250 from content-type - decode shift_jis from meta charset - infer shift_jis with jschardet Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Walkthrough
Merge Risk:
|
There was a problem hiding this comment.
🔇 Additional comments: 1
.github/workflows/benchmark.yml-59-60: 1
59-60:Major · Functional Correctness · Quick win
⚠️ Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.Fail the comparison when an available base benchmark fails.
If the base benchmark exists but fails in every round,
run_sidelogs warnings and continues. The Compare step then reports head results without a base value, and the job succeeds. The base install fallback at Lines 45–48 has the same effect. Skip comparison only when the base has no benchmark; otherwise fail on install or benchmark errors.

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: defaults
- Review profile: CHILL
- Plan: Advanced
- Run ID:
a7359175-2755-4f05-8606-8c8f82ccedb0
Files selected for processing: 4-
.github/workflows/benchmark.yml.gitignorebenchmark/index.jspackage.json
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
-
Adds
benchmark/index.jsand abenchmarkworkflow that compares base and head on the same runner. Library source is untouched.Cases
Each case takes one of the three ways
getEncodingcan resolve a charset, using the existing test fixtures.decode windows-1250 from content-typedecodes the 130 KBrp.pl.htmlwith the charset in the header. This measures thecharsetlookup plusiconv.decodeon a large single-byte document.decode shift_jis from meta charsetpasses a baretext/html, so the charset comes from the document head of51242_54045.html.infer shift_jis with jschardetuses the same document with itsencoding=/charset=declarations stripped (built at startup with iconv-lite), so every call falls through tojschardet.detect. This is the slowest path, about 0.8 ms per 6.6 KB call.Local baseline
Node v24.16.0, arm64, median of 7 samples per run.
Locally,
npm test(lint + tests) passes andnode benchmark/index.jsexits 0. Each case asserts its own output, so a broken function cannot report a fast time. The workflow comes from the shared generator: it runs base and head alternately for 5 rounds on one runner and comments the medians on the PR.🤖 Generated with Claude Code
Note
Low Risk
Only CI, benchmark harness, and ignore/script wiring; no changes to
index.jsor runtime behavior.Overview
Adds automated performance regression tracking on pull requests without changing library code.
A new
benchmark/index.jsruns three timed scenarios against existing test fixtures, each hitting a different charset resolution path in the exported decoder (headerContent-Type, HTML meta charset, andjschardetinference). Samples use GC between runs, verify decoded output on every iteration, and writebenchmark-output.jsonfor CI..github/workflows/benchmark.ymlchecks out base and head, installs with pnpm, alternatesnode benchmark/index.jsfor five rounds on one runner, merges medians into a base vs head table (with graceful skip if base has no benchmark), and posts results viabenchmark-action/github-action-benchmark.npm run benchmarkand.gitignoreentries for generated benchmark artifacts complete the setup.Reviewed by Cursor Bugbot for commit 6ed34ac. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit