Skip to content

Commit

Permalink
chore: only post benchmark comment for interesting result and change …
Browse files Browse the repository at this point in the history
…threshold of interest (#6431)

Changed to using a flat percentage instead of standard deviations because it just seems like it would work better (I am a terrible statistician)

*By submitting this pull request, I confirm that my contribution is made under the terms of the [Wing Cloud Contribution License](https://github.com/winglang/wing/blob/main/CONTRIBUTION_LICENSE.md)*.
  • Loading branch information
MarkMcCulloh authored May 7, 2024
1 parent 7efb1c4 commit cf84364
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tools/hangar/src/benchmarking/compare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { parseRoundedJson } from "./util";
import { getBenchForBranch, upsertPRComment } from "./github";
import { createTable } from "./table_report";

const MINIMUM_INTERESTING_PERCENTAGE = 3;

interface ProcessedBenchData {
mean: number;
moe: number;
Expand Down Expand Up @@ -121,6 +123,8 @@ export async function compareBenchmarks(
markdown += `| :-- | --: | --: | --: |\n`;
let colors = "";

let hasInterestingResults = false;

for (const key in differences) {
const diff = differences[key];
let prependSign = "";
Expand All @@ -132,8 +136,10 @@ export async function compareBenchmarks(
appendColor = "🟩";
}

if (Math.abs(diff.meanDiff) <= diff.maxSD) {
if (diff.meanPercentDiff <= MINIMUM_INTERESTING_PERCENTAGE) {
appendColor = "⬜";
} else {
hasInterestingResults = true;
}

colors += appendColor;
Expand Down Expand Up @@ -172,7 +178,7 @@ export async function compareBenchmarks(

const prNumber = parseInt(process.env.BENCH_PR ?? "");

if (prNumber) {
if (hasInterestingResults && prNumber) {
const comment = `\
## Benchmarks
Expand Down

0 comments on commit cf84364

Please sign in to comment.