Skip to content

Instantly share code, notes, and snippets.

@sebmck
Created September 8, 2013 07:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sebmck/6482635 to your computer and use it in GitHub Desktop.
Save sebmck/6482635 to your computer and use it in GitHub Desktop.
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