Overhaul set benchmarks: split Immutable / SingleThreaded, add Set.copyOf#11721
Draft
dougqh wants to merge 1 commit into
Draft
Overhaul set benchmarks: split Immutable / SingleThreaded, add Set.copyOf#11721dougqh wants to merge 1 commit into
dougqh wants to merge 1 commit into
Conversation
…pyOf Mirror the map-benchmark overhaul for sets. Replace the single SetBenchmark (shared mutable counter under @threads(8); contains_treeSet bug that queried HASH_SET) with two classes that each pick the right threading model: - ImmutableSetBenchmark: fixed read-only membership shared across threads (@State(Scope.Benchmark)); array / sortedArray / HashSet / TreeSet / Set.copyOf (the JDK compact SetN the agent actually uses for config sets, via CollectionUtils.tryMakeImmutableSet). hit/miss split, per-thread cursor. - SingleThreadedSetBenchmark: per-thread mutable lifecycle (@State(Scope.Thread)); create/clone + contains/iterate, plus a Collections.synchronizedSet case for the uncontended synchronization tax (per-thread => bias never revoked; biased-locking story across JVMs). StringIndex rows fold in later. Result blocks empty pending a fresh multi-JVM run. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
dougqh
added a commit
that referenced
this pull request
Jun 23, 2026
…edMapBenchmark StringIndex's benchmark integration is moving to the dedicated benchmark PRs (set overhaul #11721, map overhaul #11679) and will be folded in there later. Revert both benchmark files to master so this PR is purely the StringIndex data structure + tests. Avoids the #11679/#11721 deletions-vs-edits conflicts too. Co-Authored-By: Claude Opus 4.8 (1M context) <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
Overhauls the
internal-apiset membership benchmarks, mirroring the map-benchmark overhaul (#11679). Replaces the singleSetBenchmarkwith two classes that each pick the correct threading model for their use case (@Statescope can't vary by@Param, so one class can't host both):ImmutableSetBenchmark— fixed, read-only membership shared across threads (@State(Scope.Benchmark); sharing is realistic and contention-free since nothing mutates). Comparesarray/sortedArray/HashSet/TreeSet/Set.copyOf(the JDK's compact, array-backedImmutableCollections.SetN, viaCollectionUtils.tryMakeImmutableSet— what the agent actually uses for fixed config sets). hit/miss split, per-thread lookup cursor. Sets in the tracer skew strongly toward this shape.SingleThreadedSetBenchmark— per-thread mutable lifecycle (@State(Scope.Thread)):create/clone+contains/iterate, plus aCollections.synchronizedSetcase for the uncontended synchronization tax (each thread owns its set → monitor only ever locked by one thread → the biased-locking story, read across JVM versions). UnsynchronizedHashSetis the in-harness baseline.Why
The old
SetBenchmarkused a shared mutable rotation counter under@Threads(8)(turning fast structures into a contention measurement) and had acontains_treeSetthat actually queriedHASH_SET. The split fixes both, and theSet.copyOfcase answers a real question: for our ~10 fixedstatic final HashSetconfig sites, is the JDK's compact immutable set better thanHashSeton speed/footprint?Notes
Set.copyOfonly materializes the compactSetNon Java 10+ (falls back toHashSetpre-10); the synchronizedSet biased-locking delta shows across Java 11 → 17. Result blocks are intentionally empty pending a fresh multi-JVM run.StringIndex(Add StringIndex: a generic open-addressed string set #11660) rows fold into these later — kept out so this lands independent of that data structure.🤖 Generated with Claude Code