Created
April 10, 2012 17:02
-
-
Save billywhizz/2352874 to your computer and use it in GitHub Desktop.
streamline.js overhead
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
test.js: | |
29,222,676 calls per second | |
test-named: | |
50,505,050 calls per second | |
test-streamline.js: | |
332,557 calls per second |
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
node test.js 50 | |
_node test-streamline.js 1 |
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
function doIt (i, callback) { | |
callback(i); | |
} | |
var start = new Date(); | |
var runs = parseInt(process.argv[2] || 1) * 1000000; | |
var val = 0; | |
function next(val) { | |
if (val === runs) { | |
var end = new Date(); | |
console.log(runs + "\t" + (end - start) + "\t" + runs/((end-start)/1000)); | |
} | |
} | |
for (var i = 0; i <= runs; i++) { | |
doIt(i, next); | |
} |
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
function doIt (i, _) { | |
return i; | |
} | |
var start = new Date(); | |
var runs = parseInt(process.argv[2] || 1) * 1000000; | |
for (var i = 0; i <= runs; i++) { | |
var result = doIt(i, _); | |
if (result === runs) { | |
var end = new Date(); | |
console.log(runs + "\t" + (end - start) + "\t" + runs/((end-start)/1000)); | |
} | |
} |
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
function doIt (i, callback) { | |
callback(i); | |
} | |
var start = new Date(); | |
var runs = parseInt(process.argv[2] || 1) * 1000000; | |
for (var i = 0; i <= runs; i++) { | |
doIt(i, function (val) { | |
if (val === runs) { | |
var end = new Date(); | |
console.log(runs + "\t" + (end - start) + "\t" + runs/((end-start)/1000)); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment