Skip to content

Instantly share code, notes, and snippets.

@briancavalier
Created November 3, 2014 01:09
Show Gist options
  • Select an option

  • Save briancavalier/c5332accfd216bde374d to your computer and use it in GitHub Desktop.

Select an option

Save briancavalier/c5332accfd216bde374d to your computer and use it in GitHub Desktop.
when.map perf
var when = require('../../../when');
var a = [];
for(var i=0; i<1000000; ++i) {
a[i] = when.resolve(i);
}
var start = Date.now();
when.map(a, function(x) {
return add(x, 1);
}).done(function(r) {
console.log('when.map', Date.now() - start, r.length);
});
function add(x,y) {
return x + y;
//return when.resolve(x + y);
}
when.map 5557 1000000
when.map 255 1000000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment