Make ThreadSafeMapBenchmark lookup index per-thread (remove shared-counter contention)#11988
Draft
dougqh wants to merge 1 commit into
Draft
Make ThreadSafeMapBenchmark lookup index per-thread (remove shared-counter contention)#11988dougqh wants to merge 1 commit into
dougqh wants to merge 1 commit into
Conversation
…unter contention) nextLookupKey used a shared static counter incremented from all @threads(8) — a cache-line-contended race that floors the fastest reads and masks the very differences the benchmark compares (mirrors the per-thread index SingleThreadedMapBenchmark already uses, and the set-benchmark fix in #11721). Maps stay static/shared; only the lookup index goes per-thread via @State(Scope.Thread). Existing Javadoc numbers predate this and need a rerun. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
🟢 Java Benchmark SLOs — All performance SLOs passed
PR vs. master results
Commit: Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion. |
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.
What Does This Do
Makes
ThreadSafeMapBenchmark's lookup-key cursor per-thread instead of a shared static counter.Why
nextLookupKeyincremented astatic int sharedLookupIndexfrom all@Threads(8)— a cache-line-contended data race. That counter traffic is a fixed floor added to everyget_*measurement; for the fastest reads it dominates, compressing exactly the differences the benchmark exists to show.SingleThreadedMapBenchmarkalready uses a per-thread index, and the set benchmarks got this fix in #11721 — this brings the map suite in line (it was only ever done for sets).How
@State(Scope.Thread)on the class;static int sharedLookupIndex→ instanceint lookupIndex;nextLookupKey→ instance methods.static/shared — that's the point (concurrent reads of one shared map); only the index goes per-thread.Note
The committed Javadoc numbers predate this and need a rerun.
🤖 Generated with Claude Code