Created
March 29, 2023 16:45
-
-
Save rms1000watt/a93f6509b034537af9fc8f41c6a461e6 to your computer and use it in GitHub Desktop.
benchmark in nodejs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Benchmark = require('benchmark'); | |
suite | |
.add('test1', function() { | |
console.log('stuff'); | |
}) | |
.add('test2', function() { | |
console.log('stuff'); | |
}) | |
.on('cycle', function(event) { | |
console.log(String(event.target)); | |
}) | |
.on('complete', function() { | |
console.log('Fastest is ' + this.filter('fastest').map('name')); | |
}) | |
.run({ 'async': true }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment