Created
November 3, 2014 01:09
-
-
Save briancavalier/c5332accfd216bde374d to your computer and use it in GitHub Desktop.
when.map perf
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
| 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); | |
| } |
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
| when.map 5557 1000000 |
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
| when.map 255 1000000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment