Skip to content

Ziplex: add benchmark CI job with HTML report - #192

Open
samuelchassot wants to merge 45 commits into
mainfrom
sam/ziplexbenchmarkCI
Open

samuelchassot wants to merge 45 commits into
mainfrom
sam/ziplexbenchmarkCI

Conversation

@samuelchassot

Copy link
Copy Markdown
Contributor

Adds a manually triggered CI job that runs a time-boxed selection of the Ziplex benchmarks and produces a self-contained HTML report, in the same spirit as the mutablemaps benchmark job (#191).

Stacked on sam/characterDescriptors: the regex benchmarks with ranges come from that branch.

What is measured

  • Regex matching
    • Clément's 20 patterns, with and without ranges, with and without memoization (sizes 176, 344, 512).
    • The zipper matcher against the derivative-based matcher and scala.util.matching.Regex.
  • Lexing
    • The V3 tail-recursive memoized lexer (Lexer.lexMem) against Silex on a and a*b, JSON and Amy.
    • The same lexer against flex on a and a*b, timed with hyperfine.
  • Coqlex is shown in the report from the reference results in benchmark_results/from_coqlex. It is not measured by the job and comes from another machine.

What is added

  • .github/workflows/ziplex-benchmarks.yml: workflow_dispatch job on the self-hosted runner, with two inputs:
    • profile: standard (about 2h15) or smoke (about 10 minutes, checks the pipeline, not the numbers).
    • stainless: main by default (cloned and built from the sources), or a release x.y.z.
      The report, the JMH JSON results and the logs are uploaded as the ziplex-benchmarks artifact, and a summary table is written to the job page.
  • lexers/regex/ziplex/run_benchmarks_ci.sh: compiles once, then runs each benchmark group with JMH. Results of the groups that finished are kept if another one fails.
  • lexers/regex/ziplex/switch_imports.py: switches the sources between the verification imports and the benchmarking imports. The benchmark script restores the verification imports when it finishes.
  • lexers/regex/ziplex/benchmark_results/generate_benchmark_report.py: builds the HTML report and the Markdown summary (Python standard library only).
  • README.md: a section describing the above.

Notes

  • Stainless version. The sources use AbstractMethodBody, which is only on Stainless main (not in 0.10.5), hence the main default. With an older release, the script adds an equivalent definition at compile time, from target/, without touching the sources.
  • flex and hyperfine. The script installs flex, gcc and hyperfine when they are missing, using the package manager as root or with password-less sudo. If it cannot, the flex comparison is skipped and reported as such. INSTALL_MISSING_TOOLS=0 disables the install.
  • Concurrency. The job shares the concurrency group of the mutablemaps benchmarks, so the two never run at the same time on the runner.

Testing

  • Full standard run locally with Stainless 0.10.5: 2h16, all six JMH groups passed.
  • flex group run separately on all six input files: 132 s.
  • smoke runs against Stainless main (built from sources at 566e008) and against 0.10.5.
  • Not yet run on the CI runner itself, and the full standard run has not been timed with the Stainless main build included (about 10 extra minutes expected).

# Conflicts:
#	lexers/regex/.DS_Store
#	lexers/regex/ziplex/src/main/scala/com/ziplex/lexer/LexerInterface.scala
#	lexers/regex/ziplex/src/main/scala/com/ziplex/lexer/Main.scala
#	lexers/regex/ziplex/src/main/scala/com/ziplex/lexer/VerifiedLexer.scala
#	lexers/regex/ziplex/src/main/scala/com/ziplex/lexer/VerifiedRegex.scala
#	lexers/regex/ziplex/stainless.conf
#	lexers/regex/ziplex/verify.sh
- run_benchmarks_ci.sh: time-boxed selection of the benchmarks (about 2h15):
  Clément's regex patterns with and without ranges, zipper matcher against
  derivatives and scala.util.matching.Regex, V3 memoized lexer against Silex
  and flex. Parametric on the Stainless version (release x.y.z, or main built
  from the sources); installs flex and hyperfine when they are missing.
- switch_imports.py: switch the sources between verification and
  benchmarking imports.
- generate_benchmark_report.py: self-contained HTML report and Markdown
  summary, including the Coqlex reference results.
- ziplex-benchmarks.yml: manually triggered workflow on the self-hosted runner.
Copilot AI balanced review requested due to automatic review settings November 26, 2026 08:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@samuelchassot
samuelchassot changed the base branch from main to sam/characterDescriptors November 26, 2026 08:15
Base automatically changed from sam/characterDescriptors to main November 26, 2026 14:15
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.

2 participants