String concatenation
JavaScript performance comparison
Info
Different ways to concatenate strings together
Preparation code
<script>
var one = String.fromCharCode(Math.floor(Math.random() * 128));
var two = String.fromCharCode(Math.floor(Math.random() * 128));
var three = String.fromCharCode(Math.floor(Math.random() * 128));
var four = String.fromCharCode(Math.floor(Math.random() * 128));
var arr = [one, two, three, four]
</script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
Test  Ops/sec  

Direct concatenation 

pending… 
Individual += statements 

pending… 
Individual statements 

pending… 
Using Array#join 

pending… 
Single individual statement 

pending… 
Function based (for) 

pending… 
Compare results of other browsers
Revisions
You can edit these tests or add even more tests to this page by appending /edit
to the URL. Here’s a list of current revisions for this page:
 Revision 1: published
 Revision 2: published
 Revision 3: published
 Revision 7: published
 Revision 8: published
 Revision 10: published
 Revision 14: published by Redger
 Revision 15: published by collibra
 Revision 16: published
 Revision 17: published
 Revision 18: published
 Revision 19: published
 Revision 20: published
 Revision 21: published
 Revision 23: published
 Revision 25: published by Hans
 Revision 26: published
 Revision 27: published
 Revision 28: published
 Revision 29: published
 Revision 31: published
 Revision 32: published
 Revision 33: published
 Revision 34: published
 Revision 35: published
 Revision 36: published
 Revision 37: published
 Revision 38: published
 Revision 39: published
 Revision 40: published by ichi
 Revision 41: published
 Revision 42: published
 Revision 44: published
 Revision 45: published
 Revision 46: published
 Revision 47: published
 Revision 48: published by stringconcat
 Revision 50: published by JoeSimmons
 Revision 51: published
 Revision 52: published
 Revision 53: published
 Revision 55: published by Dan
 Revision 56: published
 Revision 57: published
 Revision 59: published by GarrettS
 Revision 60: published by TNO
 Revision 61: published
 Revision 62: published
 Revision 63: published
 Revision 64: published
 Revision 65: published
 Revision 66: published
 Revision 67: published by Rafael Soares
 Revision 68: published
 Revision 69: published by Fuwei Chin
 Revision 71: published
 Revision 72: published
 Revision 73: published
 Revision 74: published
 Revision 75: published by Arjun
 Revision 77: published by Oleksandr Kelepko
 Revision 78: published
 Revision 79: published
 Revision 81: published by hiasltiasl
 Revision 82: published by http://dennisfutures.com
 Revision 83: published
 Revision 84: published
 Revision 85: published by madreason
 Revision 87: published by ger
 Revision 89: published by oleg
 Revision 91: published
 Revision 92: published
 Revision 93: published
 Revision 94: published
 Revision 95: published
 Revision 96: published by Manast
 Revision 97: published
 Revision 98: published
 Revision 99: published
0 comments