Repository navigation
Add CodSpeed performance benchmarks - #5
Open
codspeed[bot] wants to merge 2 commits into
Open
codspeed[bot] wants to merge 2 commits into
codspeed[bot] wants to merge 2 commits into
Conversation
Benchmark the Clojure implementations through JMH using the CodSpeed JMH fork (git submodule), and run them in walltime mode on CodSpeed macro runners.
Author
Congrats! CodSpeed is installed 🎉
You will start to see performance impacts in the reports once the benchmarks are run from your default branch. 1 warning
|
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
This PR sets up continuous performance tracking with CodSpeed. CodSpeed supports the JVM through a fork of JMH (Java Microbenchmark Harness), so the benchmarks are JMH classes that call the Clojure functions directly. The measurements use the walltime instrument.
The CodSpeed workflow passed on this PR and reported all 50 benchmarks (run).
Note on runners
The benchmark job currently runs on
ubuntu-latest. I first targeted CodSpeed macro runners (codspeed-macro), but no macro runner picked up the job, so they don't seem to be enabled for this organization yet. On shared GitHub runners, walltime results vary a lot more than on macro runners, and CodSpeed shows a "Walltime results may be unreliable" warning about it. Once macro runners are enabled, changeruns-on: ubuntu-latesttoruns-on: codspeed-macroin.github/workflows/codspeed.yml. See also walltime usage outside macro runners.What's included
third-party/codspeed-jvm: git submodule pinned tov0.2.1of CodSpeedHQ/codspeed-jvm. It provides the CodSpeed JMH fork, which isn't published to Maven Central yet.bench/: a small standalone Gradle project (with its own wrapper) that keeps the JVM benchmark tooling out of thedeps.ednsetup:settings.gradle.ktsswaps upstream JMH for the CodSpeed fork through a composite build.build.gradle.ktsuses theme.champeau.jmhplugin. It adds../src,../resourcesand the fixtures to the benchmark classpath, so the Clojure code is loaded straight from source.src/jmh/clojure/.../fixtures.cljbuilds deterministic inputs from seededjava.util.Random: random vectors, text, graphs and grids.src/jmh/java/...: 50 benchmarks in 8 groups:.github/workflows/codspeed.ymlruns on pushes tomain, on pull requests and onworkflow_dispatch. It fetches only the JMH fork and its native hooks (not the example submodules bundled with codspeed-jvm), builds the benchmark jar, and runs it throughCodSpeedHQ/action@v5inwalltimemode. It authenticates with OIDC.The existing CI (cljfmt and the test suite) is unchanged and passes.
fixtures.cljpasses cljfmt.Running locally
Next steps
codspeed-macroto get stable measurements.mainbecomes the baseline, and later pull requests get a performance report comment.@Benchmarkmethod to one of the classes inbench/src/jmh/java/clojure_algorithms/bench/. If it needs input data, add a generator tofixtures.clj.ubuntu-latest. You can change this with the@Warmup,@Measurementand@Forkannotations on each class.If you'd like more coverage, comment
@codspeedbot add benchmarks for the matrix and backtracking namespacesand I'll add them.