Skip to content

Commit 7b1a2f4

Browse files
Eduardo LeaoEduardo Leao
authored andcommitted
adjustments to benchmark metrics
1 parent 0a60ffd commit 7b1a2f4

File tree

3 files changed

+8
-27
lines changed

3 files changed

+8
-27
lines changed

tests/benchmarks/autograd-log.json

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,11 @@
77
"max": 45.47927800000002,
88
"samples": 128,
99
"period": 20.585050375,
10-
"mean": 20.58505037500001,
10+
"mean": 100.000,
1111
"variance": 18.619710290764495,
1212
"sd": 4.315056232630636,
1313
"sem": 0.38140069041179986,
1414
"moe": 0.7475453532071277,
1515
"rme": 3.6314963509392304
16-
},
17-
{
18-
"name": "Autograd training loop iteration",
19-
"date": "2024-04-01T17:25:03.067Z",
20-
"totalTime": 2495.775811,
21-
"min": 16.812565000000006,
22-
"max": 38.58817000000005,
23-
"samples": 128,
24-
"period": 19.4982485234375,
25-
"mean": 19.498248523437493,
26-
"variance": 11.661936993893757,
27-
"sd": 3.414957831934936,
28-
"sem": 0.3018424800534129,
29-
"moe": 0.5916112609046893,
30-
"rme": 3.034176429711389
3116
}
3217
]

tests/benchmarks/compareBenchmarks.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,17 @@ export async function compareBenchmarks(
3434
// The difference as a percentage
3535
// e.g. (0.8ms / 19.88ms) * 100 = 4.024%
3636
const diffMeanPercent = (Math.abs(diffMean) / LAST_BENCH.mean) * 100;
37-
// If the new benchmark exceeds the last margin of error we should notify the user
38-
// e.g. 4.024% > 3.06%
39-
if (diffMeanPercent > LAST_BENCH.rme) {
40-
// By how much does the new benchmark exceed the last margin of error?
41-
// e.g. 4.024% - 3.06% = 0.964% => "New benchmark exceeded last margin by 0.964%"
42-
const diffRME = Math.abs(diffMeanPercent - LAST_BENCH.rme);
37+
// If the new benchmark is faster by more than (margin of error), notify user:
38+
if (Math.abs(diffMeanPercent) > LAST_BENCH.rme + task.result.rme) {
39+
// By how much does the new benchmark exceed the benchmark?
40+
const diffMinusRME = Math.abs(diffMeanPercent - LAST_BENCH.rme - task.result.rme);
4341
if (mean > LAST_BENCH.mean) {
4442
console.log(
45-
`New benchmark mean execution time exceeded the last by its margin of error plus ${diffRME.toFixed(2)}%`
43+
`New benchmark mean execution time exceeded the last by at least ${diffMinusRME.toFixed(2)}% (considering new and last's margin of error)`
4644
);
4745
} else {
4846
console.log(
49-
`New benchmark mean execution time is ${diffRME.toFixed(2)}% below the last minus its margin of error`
47+
`New benchmark mean execution time is at least ${diffMinusRME.toFixed(2)}% below the last (considering new and last's margin of error)`
5048
);
5149
}
5250
}

tests/benchmarks/formatTrainingResults.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Bench, Task, TaskResult } from "tinybench";
1+
import { Bench, TaskResult } from "tinybench";
22

33
/**
44
* Reformat the tinybench table to display Average Time in milliseconds and
@@ -46,11 +46,9 @@ export function formatTrainingResults(
4646

4747
return {
4848
"Task Name": row["Task Name"],
49-
"ops/sec": Number.parseInt(row["ops/sec"], 10),
5049
"Average Time (ms)": Number(row["Average Time (ns)"]) / 1e6,
5150
Margin: row["Margin"],
5251
Samples: row["Samples"],
53-
"Average Change in Loss": averageLoss,
5452
...additionalColumns
5553
};
5654
});

0 commit comments

Comments
 (0)