fix(uri): make benchmark source file detection language-agnostic - #16
Draft
not-matthias wants to merge 1 commit into
Draft
not-matthias wants to merge 1 commit into
not-matthias wants to merge 1 commit into
Conversation
Resolve the source path from the class file's SourceFile attribute first, then fall back to searching known source extensions (java, kt, scala, groovy) instead of hardcoding .java. Kotlin and Scala benchmarks now get the correct file_path in their CodSpeed URI.
Hooray! CodSpeed harness just leveled up!The base and head of this comparison were measured with different runner settings, so their benchmark values are not directly comparable. What changed between base and head:
Re-run the base with the same settings to get a valid performance comparison. Comparing |
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
BenchmarkUri.resolveSourceFilehardcoded a.javasuffix when locating a benchmark's source file for the CodSpeed URI ({file_path}::{classQName}::{method}), so Kotlin/Scala benchmarks silently got a non-existentFoo.javapath.Resolution order is now:
<pkg>/<SourceFile>whereSourceFileis read from the compiled class file'sSourceFileattribute (ClassFileSourceName). This covers Kotlin, where the file name often differs from the class name (e.g.benchmarks.kt).<pkg>/<SimpleName>.{java,kt,scala,groovy}found on disk.<pkg>/<SourceFile>if known, else<pkg>/<SimpleName>.java(unchanged from before).findFilewas refactored into a single predicate-based walker; skip rules (hidden dirs,build,target,node_modules) are unchanged.Testing
BenchmarkUriTest: 17/17 (10 new: kt/scala by extension, Kotlin file name differing from class name, skippedbuild/, inner class, both fallbacks, realSourceFileread, end-to-end path for the test class itself).class KotlinBenchinbenchmarks.ktwith kotlinc 2.4 and ran the cached public path:sourcefile=benchmarks.kt,resolved=src/com/example/benchmarks.kt.Fixes COD-3563