`benchmarkMode: "time"` does not respect `minSamples`

Open
#130 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
javascript, node.js
Domain
performance

Research direction

Start by running the provided reproduction in bench-node and trace how benchmarkMode: "time" handles each suite entry's minSamples option. Done means both the asynchronous and synchronous examples perform at least 30 samples when run in time mode.

Written by the indexing model from the issue text.

Description

E.g:

const { Suite } = require('bench-node');
const { spawn, spawnSync } = require('node:child_process')

async function spawnProcess() {
  const proc = spawn(
    process.execPath,
    [
      '-e',
      '1 + 1'
    ]);

  return new Promise((resolve) => {
    proc.on('exit', (code) => {
      resolve();
    })
  })
}

function spawnProcessSync() {
  const proc = spawnSync(
    process.execPath,
    [
      '-e',
      '1 + 1'
    ]);
}

const suite = new Suite({ benchmarkMode: "time" });

suite.add('Async spawnProcess', { minSamples: 30 }, async () => {
  await spawnProcess();
});

suite.add('Sync spawnProcess', { minSamples: 30 }, () => {
  spawnProcessSync();
});

suite.run();
Dominant language
JavaScript
Stars
193
Forks
19
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from RafaelGSS/bench-node

All issues in RafaelGSS/bench-node

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.