Skip to content

Instantly share code, notes, and snippets.

@rlidwka
Created December 4, 2014 23:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rlidwka/be32e6cc5784bcf4bf7a to your computer and use it in GitHub Desktop.
Save rlidwka/be32e6cc5784bcf4bf7a to your computer and use it in GitHub Desktop.
var Benchmark = require('benchmark')
var suite = new Benchmark.Suite
var foo = { }
var util = require('util')
// add tests
suite.add('Object.create()', function() {
return Object.create(foo)
})
.add('util._extend()', function() {
return util._extend({}, foo)
})
// add listeners
.on('cycle', function(event) {
console.log(String(event.target))
})
.on('complete', function() {
console.log('Fastest is ' + this.filter('fastest').pluck('name'))
})
// run async
.run({ 'async': true })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment