Skip to content

Instantly share code, notes, and snippets.

@faridnsh
Created February 20, 2013 09:16
Show Gist options
  • Save faridnsh/4994209 to your computer and use it in GitHub Desktop.
Save faridnsh/4994209 to your computer and use it in GitHub Desktop.
Sugar multi match benchmark
var Benchmark = require('benchmark');
var suite = new Benchmark.Suite;
require('./release/sugar-full.development');
var empty = [];
var with500 = [];
500..times(function () {
with500.push({});
});
// add tests
suite.add('emptyArray.Find(emptyFunction)', function() {
empty.find(function () {});
}).add('arrayWith500.Find(emptyFunction)', function() {
with500.find(function () {});
})
// add listeners
.on('cycle', function(event) {
console.log(String(event.target));
})
// run async
.run();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment