Skip to content

perf(benchmark): refine JMH benchmark suite#2672

Merged
Ahoo-Wang merged 2 commits into
mainfrom
perf/wow-benchmarks-split
Jun 7, 2026
Merged

perf(benchmark): refine JMH benchmark suite#2672
Ahoo-Wang merged 2 commits into
mainfrom
perf/wow-benchmarks-split

Conversation

@Ahoo-Wang

Copy link
Copy Markdown
Owner

Summary

  • Split the benchmark-only changes out of PR perf(core): optimize benchmarked hot paths #2671 into an isolated wow-benchmarks/ PR.
  • Move JMH packaging and reporting Gradle logic into dedicated scripts.
  • Add and stabilize smoke coverage for command, event store, Redis, and hot-path benchmark fixtures.

Testing

  • ./gradlew benchmarkSmoke --stacktrace

Risk & Compatibility

  • Low risk; changes are scoped to wow-benchmarks/ and do not alter runtime modules.

@codacy-production

codacy-production Bot commented Jun 7, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 104 complexity

Metric Results
Complexity 104

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@codecov

codecov Bot commented Jun 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.75%. Comparing base (38d0e50) to head (b33739d).

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #2672   +/-   ##
=========================================
  Coverage     92.75%   92.75%           
  Complexity     4073     4073           
=========================================
  Files           737      737           
  Lines         13181    13181           
  Branches        922      922           
=========================================
  Hits          12226    12226           
  Misses          578      578           
  Partials        377      377           
Flag Coverage Δ
local 81.56% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8fbb35730a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

}
@Suppress("UNCHECKED_CAST")
val primaryMetric = result["primaryMetric"] as Map<String, Any>
key to (primaryMetric["score"] as Double)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Parse JMH scores as Numbers before comparison

When :wow-benchmarks:benchmarkCompare reads normal JMH JSON, JsonSlurper returns decimal JSON numbers as java.math.BigDecimal rather than Double (I verified this with the Groovy runtime bundled in Gradle 8.14.4). This cast therefore throws a ClassCastException as soon as it sees a typical decimal primaryMetric.score, whereas the previous Jackson parser produced Double; use the existing parseMetricNumber helper or cast through Number here.

Useful? React with 👍 / 👎.

private fun flushDb() {
val connection: ReactiveRedisConnection = connectionFactory.reactiveConnection
try {
connection.serverCommands().flushDb().block(FLUSH_TIMEOUT)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid flushing the default Redis database

When any Redis benchmark constructs this fixture, RedisStandaloneConfiguration() defaults to localhost DB 0, and this call flushes the entire selected database during setup and teardown. Running :wow-benchmarks:benchmarkExternal or the Redis benchmarks on a developer/CI host with a shared local Redis will wipe unrelated keys before the benchmark starts; use a dedicated database/key prefix or delete only benchmark-owned keys.

Useful? React with 👍 / 👎.

val snapshot = SimpleSnapshot(aggregate)
snapshotRepository.save(snapshot).block()

val eventStream = createEventStream()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use the saved aggregate ID for snapshot loads

In this setup, aggregateId is generated separately from the aggregate ID inside createEventStream() (that helper calls cartAggregateMetadata.aggregateId() again). Saving SimpleSnapshot(stateEvent) therefore stores the snapshot under stateEvent.aggregateId, while snapshotLoad() later loads with the different aggregateId field, so the benchmark measures a cache miss/empty load instead of loading the saved snapshot; build the event stream with the same aggregate ID or load by the saved one.

Useful? React with 👍 / 👎.

@Ahoo-Wang Ahoo-Wang merged commit a5a7b13 into main Jun 7, 2026
6 of 7 checks passed
@Ahoo-Wang Ahoo-Wang deleted the perf/wow-benchmarks-split branch June 7, 2026 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant