Skip to content

Commit 726cec4

Browse files
committed
use dedicated agent
1 parent 9df14a3 commit 726cec4

File tree

4 files changed

+20
-17
lines changed

4 files changed

+20
-17
lines changed

.buildkite/benchmark.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ set -euo pipefail
55
repo_pwd="$PWD"
66
mkdir -p benchmark-output/{pr,base}
77

8+
warmup_cpu() {
9+
node -e "let s=0; for(let i=0;i<5e7;i++)s+=Math.sqrt(i); console.log('CPU warm')" > /dev/null
10+
sleep 2
11+
}
12+
813
run_benchmark() {
914
local target="$1"
1015

@@ -14,6 +19,7 @@ run_benchmark() {
1419
fi
1520

1621
npm install --silent
22+
warmup_cpu
1723
npm run benchmark
1824
mv benchmark*.json "$repo_pwd/benchmark-output/$target"
1925

.buildkite/benchmark.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
22
agents:
3-
memory: "2G"
3+
memory: "4G"
44

55
steps:
6-
- label: ":elasticsearch: :javascript: ES JavaScript Transport Benchmark (Linux)"
6+
- label: "ES JavaScript Transport Benchmark (Linux)"
77
command: ./.buildkite/benchmark.sh
88
agents:
9-
image: node:lts
9+
image: node:22

scripts/compare-benchmark-json.mjs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -305,14 +305,14 @@ function generateSummary() {
305305
let summary = `## Summary\n\n`
306306

307307
if (regressions.failures.length === 0 && regressions.warnings.length === 0) {
308-
summary += `**PASSED** - No significant performance regressions detected.\n\n`
308+
summary += `No significant changes detected.\n\n`
309309
return summary
310310
}
311311

312312
if (regressions.failures.length > 0) {
313-
summary += `**FAILED** - ${regressions.failures.length} regression(s) detected\n\n`
314-
summary += '| Metric | Regression |\n'
315-
summary += '|--------|------------|\n'
313+
summary += `**${regressions.failures.length} metric(s) exceeded threshold**\n\n`
314+
summary += '| Metric | Change |\n'
315+
summary += '|--------|--------|\n'
316316
for (const { metric, change } of regressions.failures) {
317317
summary += `| ${metric} | ${change >= 0 ? '+' : ''}${change.toFixed(1)}% |\n`
318318
}
@@ -329,14 +329,6 @@ function generateSummary() {
329329
summary += '\n'
330330
}
331331

332-
summary += `### Thresholds\n\n`
333-
summary += `| Type | Warning | Failure |\n`
334-
summary += `|------|---------|---------|\n`
335-
summary += `| Latency | >${THRESHOLDS.latency.warning}% slower | >${THRESHOLDS.latency.failure}% slower |\n`
336-
summary += `| Throughput | >${Math.abs(THRESHOLDS.throughput.warning)}% slower | >${Math.abs(THRESHOLDS.throughput.failure)}% slower |\n`
337-
summary += `| Memory | >${THRESHOLDS.memory.warning}% larger | >${THRESHOLDS.memory.failure}% larger |\n`
338-
summary += `| GC | >${THRESHOLDS.gc.warning}% more | >${THRESHOLDS.gc.failure}% more |\n\n`
339-
340332
return summary
341333
}
342334

test/benchmark/benchmark.mjs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55
import { writeFileSync } from 'node:fs'
6-
import { run, bench, group } from 'mitata'
6+
import { run, bench, group, configure } from 'mitata'
77
import {
88
Transport,
99
WeightedConnectionPool,
@@ -13,6 +13,11 @@ import {
1313
UndiciConnection
1414
} from '../../index.js'
1515

16+
configure({
17+
warmup: { iterations: 1000, time: 500_000_000 },
18+
run: { iterations: 5000, time: 1_000_000_000 }
19+
})
20+
1621
group('Transport#constructor - UndiciConnection', () => {
1722
bench('WeightedConnectionPool', () => {
1823
const connectionPool = new WeightedConnectionPool({ Connection: UndiciConnection })
@@ -59,7 +64,7 @@ group('Transport#constructor - HttpConnection', () => {
5964
.gc('inner')
6065
})
6166

62-
const { layout, benchmarks } = await run()
67+
const { layout, benchmarks } = await run({ format: 'quiet' })
6368

6469
const output = {}
6570

0 commit comments

Comments
 (0)