Skip to content

Add Duel performance regression guards - #72

Merged
sferik merged 1 commit into
mainfrom
duel
Oct 25, 2026
Merged

sferik merged 1 commit into
mainfrom
duel

Conversation

@sferik

@sferik sferik commented Oct 25, 2026

Copy link
Copy Markdown
Owner

This adds Duel, a gem I wrote to catch performance regressions in CI. On every pull request it runs the benchmarks in duel/ against main and the branch side by side, and fails the build if the branch is slower or allocates more.

The 28 benchmarks reuse the payload shapes from benchmark.rb. They parse and generate everything from a tiny object to a 25,000-item array through the default adapter, plus blank and scalar input, IO, binary strings, invalid JSON, symbolize_names, pretty printing, the Oj and fast_jsonparser adapters, adapter lookup, the options cache, and the old MultiJson names.

Most of the time on big documents is spent in the JSON library, not in MultiJSON, so those benchmarks mostly catch extra allocations. The small ones are what catch overhead in MultiJSON itself, which is where a regression is most likely to come from anyway.

To check that it actually catches things, I added an options.dup to Adapter.dump, and Duel failed all nine generate benchmarks and none of the parse ones. A bit of extra work in MultiJSON.parse failed 12 benchmarks. Comparing main with itself passed three times in a row.

Duel requires Ruby 3.4, so the Gemfile only adds it on 3.4 and newer, and the Rake task is skipped when it isn't installed, like the Steep task already is. bundle install and the tests still work on 3.2, 3.3, and JRuby.

Benchmark parse and generate through the default adapter in the shapes
and sizes of benchmark.rb, plus blank, scalar, IO, binary and invalid
input, options, the Oj and fast_jsonparser adapters, adapter
resolution, the options cache and the deprecated MultiJson names.

The perf workflow compares each pull request with main, each push with
the commit before it, and the last release on a schedule. Duel needs
Ruby 3.4 or later, so the Gemfile and Rakefile skip it on older Rubies.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-25T15:57:03.117135Z de25d61 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

Copy link
Copy Markdown

Duel: nothing to compare

duel: lib, ext unchanged since the baseline, so there's nothing to compare (--force to anyway)

@sferik
sferik merged commit c2bf295 into main Oct 25, 2026
67 of 68 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant