Skip to content

Commit e90873b

Browse files
committed
Add multiple batch sizes to benchmark
1 parent f7bcc41 commit e90873b

File tree

2 files changed

+461
-321
lines changed

2 files changed

+461
-321
lines changed

packages/d2ts-benchmark/src/base.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export class Suite {
4949
const result: RunResult = {
5050
startupTime: 0,
5151
firstRunTime: 0,
52-
incrementalTimes: [],
52+
incrementalTimes: new Array(this.incrementalRuns).fill(0),
5353
teardownTime: 0,
5454
}
5555

@@ -65,11 +65,13 @@ export class Suite {
6565
for (let i = 0; i < this.incrementalRuns; i++) {
6666
start = performance.now()
6767
benchmark.incrementalRun(ctx, i)
68-
result.incrementalTimes.push(performance.now() - start)
68+
result.incrementalTimes[i] = performance.now() - start
6969
if (
7070
this.maxTimeDoingIncrementalRuns &&
7171
performance.now() - startedAt > this.maxTimeDoingIncrementalRuns
7272
) {
73+
// truncate the array to the current index
74+
result.incrementalTimes = result.incrementalTimes.slice(0, i)
7375
break
7476
}
7577
}

0 commit comments

Comments
 (0)