Calculates a diff in milliseconds between invocations.
npm install hrtime-millisecondsCalculates a diff in milliseconds between invocations. Originally I wanted to use process.hrtime, but it looks like Date.now is faster since it doesn't need any conversion.
``
const start = require('hrtime-milliseconds')
const diff = start()
console.log(diff) // returns milliseconds
setTimeout(function () {
start() // second invocation returns new diff since start
}, 100)
`
In case you'd like to keep the nanosecond precision, use another module.
`
NANOBENCH version 2
> /Users/marcbachmann/.nvm/versions/node/v8.1.2/bin/node bench.js
all benchmarks completed
ok ~5.27 s (5 s + 266317108 ns)
``