feat: support flamegraphs in Java walltime#2
feat: support flamegraphs in Java walltime#2not-matthias wants to merge 12 commits intocod-2308-walltime-benchmarks-without-flamegraphsfrom
Conversation
COD-2309 Walltime benchmarks WITH flamegraphs
What?Builds on top of COD-2308, adds:
Other stuff that might be needed:
How?
|
Merging this PR will improve performance by ×270
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ⚡ | bench.RleBenchmark.encode |
274 µs | 1 µs | ×270 |
| ⚡ | bench.RleBenchmark.decode |
1,896.2 ns | 737.4 ns | ×2.6 |
| ⚡ | bench.FibBenchmark.fib |
9.5 ms | 3.3 ms | ×2.8 |
Comparing cod-2309-walltime-benchmarks-with-flamegraphs (a606260) with cod-2308-walltime-benchmarks-without-flamegraphs (580ee7c)
9fb8b8d to
1cbf994
Compare
7baf522 to
fd966b0
Compare
a606260 to
0019809
Compare
Merging this PR will create unknown performance changes
Performance Changes
Comparing Footnotes
|
cf5f6ac to
14a4302
Compare
There was a problem hiding this comment.
Pull request overview
Adds CodSpeed-flavored benchmark URIs and introduces a non-inlined “root frame” wrapper in the JMH codegen to make Java walltime flamegraphs more usable, while reorganizing examples and CI to exercise the new behavior.
Changes:
- Introduce
io.codspeed.BenchmarkUriand propagate URI usage into result collection and instrumentation hooks. - Modify JMH generator to emit a non-inlined root-frame method and route benchmark calls through it.
- Restructure examples under
examples/and update CI to run them (including walltime runs across multiple JDK distributions).
Reviewed changes
Copilot reviewed 29 out of 30 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| settings.gradle.kts | Updates Gradle project include path to the new examples layout. |
| jmh-fork/jmh-core/src/main/java/io/codspeed/BenchmarkUri.java | Adds URI construction + source file resolution logic. |
| jmh-fork/jmh-core/src/test/java/io/codspeed/BenchmarkUriTest.java | Adds unit tests for URI pieces (bench name + source path fallback). |
| jmh-fork/jmh-core/src/main/java/org/openjdk/jmh/runner/Runner.java | Forces forks off when instrumented (for flamegraphs) and reports executed benchmark via URI. |
| jmh-fork/jmh-core/src/main/java/org/openjdk/jmh/runner/BaseRunner.java | Starts/stops CodSpeed hooks for embedded runs and reports executed benchmark via URI. |
| jmh-fork/jmh-core/src/main/java/org/openjdk/jmh/generators/core/BenchmarkGenerator.java | Emits a DONT_INLINE “root frame” wrapper and routes stub invocations through it. |
| jmh-fork/jmh-core/src/main/java/io/codspeed/result/CodSpeedResultCollector.java | Stores URI alongside benchmark name in walltime results. |
| jmh-fork/jmh-core/build.gradle.kts | Adds JUnit dependency for the new tests. |
| examples/example-gradle/** | Adds new Gradle example project and benchmarks (incl. TheAlgorithms-Java sources). |
| examples/example-maven/** | Adjusts Maven example layout and dependencies; adds a bench source link. |
| .github/workflows/ci.yml | Updates paths, adds caches, and expands walltime job to test multiple JDK distributions + installs a custom runner. |
| .gitmodules | Adds TheAlgorithms-Java submodule. |
| AGENTS.md / CLAUDE.md | Adds repo agent guidance / indirection file. |
Comments suppressed due to low confidence (1)
examples/example-maven/src/main/java/bench:1
- This appears to be a symlink-style “link file” to a source directory. On Windows (and some CI setups), symlinks are often checked out as plain files, which would remove the
bench/directory from the compiler’s perspective and break the Maven example build. Prefer adding the shared benchmark sources via Maven configuration (e.g., add an additional source root pointing at../example-gradle/src/jmh/java) rather than relying on symlink semantics.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
jmh-fork/jmh-core/src/main/java/org/openjdk/jmh/generators/core/BenchmarkGenerator.java
Show resolved
Hide resolved
0f6ed3e to
3dc349a
Compare
c559c2b to
7885910
Compare
Prepares for MavenCentral publishing by using a unique group ID (`io.codspeed.jmh` instead of `org.openjdk.jmh`) and dropping the `-codspeed.N` version suffix. Refs: COD-2400
Only show the "Running with CodSpeed" banner, write walltime results, and restrict benchmark modes when actually running under CodSpeed instrumentation. Restores standard JMH behavior when running locally.
7885910 to
eb1a958
Compare
00938ea to
b43be0b
Compare
|
Github is drunk, the PR has been merged onto main but it didn't detect it for some reason (probably because the base branch was set to cod-2308(?), not sure) |
No description provided.