index.js
async function run(bench) {
  let { tests, config } = bench

  if (tests.length == 0) {
    throw Error('Benchmark has no test cycles')
  }

  // Find the longest test name.
  config.width = tests.reduce(longest, 0)

  let cycles = {}
  for (let i = 0; i < tests.length; i++) {
    const test = tests[i]
    try {
      cycles[test.name] = await measure(test, bench)
    } catch (e) {
      config.onError(e)
    }
  }

  // all done!
  config.onFinish(cycles)
  bench.done(cycles)
}
async function run(bench) {
  let { tests, config } = bench

  if (tests.length == 0) {
    throw Error('Benchmark has no test cycles')
  }

  // Find the longest test name.
  config.width = tests.reduce(longest, 0)

  let cycles = {}
  for (let i = 0; i < tests.length; i++) {
    const test = tests[i]
    try {
      cycles[test.name] = await measure(test, bench)
    } catch (e) {
      config.onError(e)
    }
  }

  // all done!
  config.onFinish(cycles)
  bench.done(cycles)
}
async function run ( bench ) { let { tests , config } = bench if ( tests . length == 0 ) { throw Error ( 'Benchmark has no test cycles' ) } // Find the longest test name. config . width = tests . reduce ( longest , 0 ) let cycles = { } for ( let i = 0 ; i < tests . length ; i ++ ) { const test = tests [ i ] try { cycles [ test . name ] = await measure ( test , bench ) } catch ( e ) { config . onError ( e ) } } // all done! config . onFinish ( cycles ) bench . done ( cycles ) }
Run a benchmark
Run a benchmark