benchmark/main.js
function profileBlock(block, repeat){
  repeat = repeat || DEFAULT_REPEAT_COUNT;
  let start = process.hrtime();
  for (let i = 0; i < repeat; ++i){
    block();
  }
  let diff = process.hrtime(start);
  return Math.floor(diff[0] + diff[1] / 1e3);
}
function profileBlock(block, repeat){
  repeat = repeat || DEFAULT_REPEAT_COUNT;
  let start = process.hrtime();
  for (let i = 0; i < repeat; ++i){
    block();
  }
  let diff = process.hrtime(start);
  return Math.floor(diff[0] + diff[1] / 1e3);
}
function profileBlock ( block , repeat ) { repeat = repeat || DEFAULT_REPEAT_COUNT ; let start = process . hrtime ( ) ; for ( let i = 0 ; i < repeat ; ++ i ) { block ( ) ; } let diff = process . hrtime ( start ) ; return Math . floor ( diff [ 0 ] + diff [ 1 ] / 1e3 ) ; }
Profile code block.
@param {function} block - code to run.
@param {Number} [repeat] - Number of repeated times
@returns {Number} Total running time in microseconds.
Profile code block .