diff --git a/.github/workflows/internal-benchmark.yml b/.github/workflows/internal-benchmark.yml index f7ee5d83..e6c38b1a 100644 --- a/.github/workflows/internal-benchmark.yml +++ b/.github/workflows/internal-benchmark.yml @@ -23,12 +23,20 @@ jobs: - name: Setup Deno uses: denoland/setup-deno@v2 with: - deno-version: v2.x + deno-version: latest - uses: bencherdev/bencher@main - name: Run benchmark + run: deno task benchmark:tinybench + - name: Publish benchmark + shell: bash run: | + args=() + if [[ "$GITHUB_REF" != refs/heads/master ]]; then + args+=(--dry-run) + fi bencher run \ - --branch master \ + "${args[@]}" \ + --branch "$GITHUB_REF_NAME" \ --threshold-measure latency \ --threshold-test t_test \ --threshold-max-sample-size 64 \ @@ -41,6 +49,4 @@ jobs: --threshold-upper-boundary _ \ --thresholds-reset \ --file benchmark-report.json \ - --err \ - --github-actions ${{ secrets.GITHUB_TOKEN }} \ - "deno task benchmark:tinybench" + --err diff --git a/benchmarks/benchmarks-utils.mjs b/benchmarks/benchmarks-utils.mjs index fcac03a9..5c53ed6d 100644 --- a/benchmarks/benchmarks-utils.mjs +++ b/benchmarks/benchmarks-utils.mjs @@ -7,7 +7,7 @@ import { rmSync, writeFileSync, } from 'node:fs' -import { Bench } from 'tinybench' +import { Bench, mToNs } from 'tinybench' import { DynamicThreadPool, FixedThreadPool, @@ -292,7 +292,7 @@ export const runPoolifierBenchmarkTinyBench = async ( const bmfResults = {} let pool try { - const bench = new Bench() + const bench = new Bench({ throws: true }) pool = buildPoolifierPool(workerType, poolType, poolSize) for (const workerChoiceStrategy of Object.values(WorkerChoiceStrategies)) { @@ -364,30 +364,24 @@ export const runPoolifierBenchmarkTinyBench = async ( console.table(bench.table()) for (const task of tasks) { - if ( - task.result?.state === 'completed' || - task.result?.state === 'aborted-with-statistics' - ) { - bmfResults[task.name] = { - latency: { - value: task.result.latency.mean, - lower_value: task.result.latency.mean - task.result.latency.sd, - upper_value: task.result.latency.mean + task.result.latency.sd, - }, - throughput: { - value: task.result.throughput.mean, - lower_value: task.result.throughput.mean - - task.result.throughput.sd, - upper_value: task.result.throughput.mean + - task.result.throughput.sd, - }, - } + if (task.result?.state !== 'completed') { + throw new Error(`Benchmark did not complete: ${task.name}`) + } + bmfResults[task.name] = { + latency: { + // Tinybench reports milliseconds; Bencher latency uses nanoseconds. + value: mToNs(task.result.latency.mean), + lower_value: mToNs(task.result.latency.mean - task.result.latency.sd), + upper_value: mToNs(task.result.latency.mean + task.result.latency.sd), + }, + throughput: { + value: task.result.throughput.mean, + lower_value: task.result.throughput.mean - task.result.throughput.sd, + upper_value: task.result.throughput.mean + task.result.throughput.sd, + }, } } return bmfResults - } catch (error) { - console.error(error) - return bmfResults } finally { if (pool != null) { await pool.destroy() diff --git a/renovate.json b/renovate.json index cb6debed..5e361783 100644 --- a/renovate.json +++ b/renovate.json @@ -7,6 +7,12 @@ ":maintainLockFilesWeekly" ], "packageRules": [ + { + "matchDatasources": ["npm"], + "matchFileNames": ["**/deno.json"], + "minimumReleaseAge": "1 day", + "internalChecksFilter": "strict" + }, { "matchFileNames": ["**/package.json"], "matchDepTypes": [