000strtoarr

JavaScript performance comparison

Test case created

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    var text = 'a b c d e f g h i j k l m n o p q r s t u v w x y z';
};
</script>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
split
var arr = new Array(text.length); //48,65,97,39='
for (var i=0, len = text.length; i < len; i++) {
  47 < (c = text.charCodeAt(i)) && (arr[i] = c);
}
pending…
split_
var arr = text.split(' '); //48,65,97,39='
pending…
code
var arr = []; //48,65,97,39='
for (var i=0, len = text.length; i < len; i++) {
  arr[i] = text.charCodeAt(i);
}
pending…
splitall
var arr = text.split('');
pending…
arr trunc
var arr = new Array(text.length); //48,65,97,39='
for (var i=0, len = text.length; i < len; i++) {
  arr[i] = text.charCodeAt(i);
}
pending…

You can edit these tests or add even more tests to this page by appending /edit to the URL.

Compare results of other browsers

0 comments

Add a comment