Created
September 8, 2013 07:25
-
-
Save sebmck/6482635 to your computer and use it in GitHub Desktop.
This file contains 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 time(){ | |
var time = process.hrtime(); | |
return (time[0] * 1000) + (time[1] / 1000000); | |
} | |
var start = time(); | |
var tmp = []; | |
for (var i = 0; i < 10000; i++){ | |
tmp.push("test"); | |
} | |
tmp.join(""); | |
console.log("Join took", time() - start + "ms"); | |
start = time(); | |
tmp = ""; | |
for (var i = 0; i < 10000; i++){ | |
tmp += "test"; | |
} | |
console.log("Concat took", time() - start + "ms"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment