Skip to content

Comments

Perf metrics improvement v1.1#460

Merged
tlwillke merged 8 commits intomainfrom
perf-metrics-improvement-v1.1
Apr 22, 2025
Merged

Perf metrics improvement v1.1#460
tlwillke merged 8 commits intomainfrom
perf-metrics-improvement-v1.1

Conversation

@marianotepper
Copy link
Contributor

This PR extends #459 in a few simple ways:

  • It streamlines the way we specify which metrics to run and print
  • Enables specifying the number of decimal points for each benchmark
  • It simplifies the class structure
  • RecallBenchmark was replaced by AccuracyBenchmark that additionally allows to print the mean average precision.
  • LatencyBenchmark now returns the standard deviation instead of the latency to have all units in ms.

@marianotepper marianotepper marked this pull request as ready for review April 21, 2025 18:14
@marianotepper marianotepper requested a review from tlwillke April 21, 2025 18:14
}

@Override
public void setPrintPrecision(String fmt) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we return a QueryBenchmark here for chaining? See other comments.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Add return type QueryBenchmark.
return this;


double avgRuntimeSec = totalRuntime / queryRuns / 1e9;
return new Summary(avgRuntimeSec);
return List.of(Metric.of("QPS", getPrintPrecision(), avgRuntimeSec));
Copy link
Collaborator

Choose a reason for hiding this comment

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

The string should be "Avg Runtime (s)"

int queryRuns
);

void setPrintPrecision(String fmt);
Copy link
Collaborator

Choose a reason for hiding this comment

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

If you like the idea of chaining setPrintPrecision() in Grid, we just need a return type of QueryBenchmark here.

System.out.format("Using %s:%n", cs.index);
// 1) Select benchmarks to run
var benchmarks = List.of(
List<QueryBenchmark> benchmarks = List.of(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would like to be able to chain the .setPrintPrecision on any of these benchmarks here when instantiated. See two other comments on this.

}

@Override
public void setPrintPrecision(String fmt) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I like the way you are suggesting we set and get the precision. The only drawback I see is that it was previously set at the value level within a benchmark. That way, it could be set individually per value, not globally per benchmark. But not a big deal if each benchmark limits its produced values to ones sharing the same units and approx ranges of values.

@tlwillke tlwillke self-requested a review April 22, 2025 18:03
Copy link
Collaborator

@tlwillke tlwillke left a comment

Choose a reason for hiding this comment

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

Good changes. I think the constructor overloading for print formats fell into the telescoping constructor anti-pattern. And yet, some useful overloads are still missing. I think I prefer a chaining design which is more readable and only specifies what's relevant:

LatencyBenchmark()
    .displayAvgLatency("0.2f")  // Non-default formatting on the default column
    .displayP999Latency();  // An optional column with default formatting

But the current version is good enough for now!

@tlwillke tlwillke merged commit fbd23d5 into main Apr 22, 2025
6 checks passed
@tlwillke tlwillke deleted the perf-metrics-improvement-v1.1 branch April 22, 2025 18:43
pkolaczk pushed a commit that referenced this pull request Sep 16, 2025
* Improve configuration of benchmarking suite

* Allow to set the precision format and other minor improvements.

* Use minimal table by default

* Fix javadoc

* Fix javadoc

* Add missing license

* Enable richer setup of the printing format for each metric

* Reorder the default table columns
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.

2 participants