Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions .github/workflows/internal-benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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
40 changes: 17 additions & 23 deletions benchmarks/benchmarks-utils.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
rmSync,
writeFileSync,
} from 'node:fs'
import { Bench } from 'tinybench'
import { Bench, mToNs } from 'tinybench'
import {
DynamicThreadPool,
FixedThreadPool,
Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -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()
Expand Down
6 changes: 6 additions & 0 deletions renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
":maintainLockFilesWeekly"
],
"packageRules": [
{
"matchDatasources": ["npm"],
"matchFileNames": ["**/deno.json"],
"minimumReleaseAge": "1 day",
"internalChecksFilter": "strict"
},
{
"matchFileNames": ["**/package.json"],
"matchDepTypes": [
Expand Down
Loading