Skip to content

Commit

Permalink
feat: runBench.runs now defaults to 2 (was: 1)
Browse files Browse the repository at this point in the history
  • Loading branch information
kirillgroshkov committed May 2, 2024
1 parent 76937cf commit 2135084
Show file tree
Hide file tree
Showing 4 changed files with 679 additions and 654 deletions.
2 changes: 2 additions & 0 deletions scripts/nanoidBench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import { runBenchScript } from '../src'
const { nanoid: nanoidAsync } = require('nanoid/async')
const { nanoid: nanoidNonSecure } = require('nanoid/non-secure')

/* eslint-disable no-useless-assignment */

runBenchScript({
fns: {
nanoidNonSecure: done => {
Expand Down
2 changes: 1 addition & 1 deletion src/bench.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export interface RunBenchOptions {
* How many times to run.
* Every second run will be in reverse order.
*
* @default 1
* @default 2
*/
runs?: number

Expand Down
2 changes: 1 addition & 1 deletion src/bench.util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function runBenchScript(opt: RunBenchOptions): void {
* Only DeferredFunctions are allowed, because of: https://github.com/bestiejs/benchmark.js/issues/111
*/
export async function runBench(opt: RunBenchOptions): Promise<HertzMap> {
const { runs = 1, writeSummary = true, asciiPlot = true, name = 'runBench' } = opt
const { runs = 2, writeSummary = true, asciiPlot = true, name = 'runBench' } = opt
const { reportDirPath = `./tmp/${name}` } = opt

console.log(`running benchmark...\n\n`)
Expand Down
Loading

0 comments on commit 2135084

Please sign in to comment.