performance-measure

1.0.3 • Public • Published

performance-measure

Build Status

measure specilizing in speed up contests.

Install

npm install performance-measure

Example

codes:

const PerformanceMeasure = require('performance-measure')
 
async function main() {
  const m = new PerformanceMeasure()
  m.start('A')
  await sleep(100)
  m.end('A')
 
  m.start('A')
  await sleep(200)
  m.end('A')
 
  m.start('B')
  await sleep(100)
  m.end('B')
 
  m.start('C')
  await sleep(400)
  m.endAs('C', 'foobar')
 
  console.log(m.print())
}
 
main ()
 
function sleep(ms = 0) {
  return new Promise(resolve => setTimeout(resolve, ms));
}

result:

name    size  sum     max     min     mean  
------  ----  ------  ------  ------  ------
foobar     1  404.43  404.43  404.43  404.43
A          2  308.94  204.18  104.76  154.47
B          1  100.44  100.44  100.44  100.44

SEE ALSO: examples/*.js

License

MIT

Package Sidebar

Install

npm i performance-measure

Weekly Downloads

0

Version

1.0.3

License

MIT

Unpacked Size

8.51 kB

Total Files

8

Last publish

Collaborators

  • okamuuu