Skip to content

fix: benchmarkMode=time respect minSamples#165

Open
gusanthiago wants to merge 3 commits into
RafaelGSS:mainfrom
gusanthiago:bugfix/adjust-minSamples
Open

fix: benchmarkMode=time respect minSamples#165
gusanthiago wants to merge 3 commits into
RafaelGSS:mainfrom
gusanthiago:bugfix/adjust-minSamples

Conversation

@gusanthiago

@gusanthiago gusanthiago commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Description

Hello guys, this PR should close issue #130

Proposed Changes

  • Time mode now honors minSamples: each sample is one independent execution of the benchmark function, collected until minSamples is reached per round.
  • totalTime reports the mean execution time across all collected samples (not averaged per repeatSuite round).
  • iterations reflects the total number of samples collected (minSamples × repeatSuite).
  • Added tests covering minSamples alone and combined with repeatSuite.
  • Updated README, index.d.ts, examples/time-mode.js, and CHANGELOG to document time-mode sampling behavior.

Test plan

  • npm test -- test/time-mode.js — new tests pass:
  • node --allow-natives-syntax examples/time-mode.js
Screenshot 2026-06-21 at 23 21 04

* Create collectSamplesOfTimeMode to can record minSamples ignoring time
* Create tests of minSamples with benchmarkMode: time
@gusanthiago gusanthiago marked this pull request as ready for review June 22, 2026 02:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant