a

JavaScript performance comparison

Test case created

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    var a = ['a', 'b', 'c', 'd', 'e', 'f'];
    var b = [];
    var i;
    for(i = 0; i < 1000; ++i) b.push({a:1,b:2,c:3,d:4,e:5,f:6});
   
};
</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
1
i = 1;
var c = [['0'].concat(a).join('|')].concat(b.map(function(b_){
 return ['('+i+++')'].concat(a.map(function(a_) {
   return !b_.hasOwnProperty(a_) ? '!' : '(' + b_[a_] + ')';
 })).join('-');
})).join('\n');

console.log(1, c);
pending…
2
var c = '0|' + a.join('|') + '\n';
var t;
for(i = 0; i < b.length; i++) {
 t = b[i];
 c += t.a + '-' + t.b + '-' + t.c + '-' + t.d + '-' + t.e + '-' + t.f + '\n';
}

console.log(2, c);
pending…
3
i = 1;
var f_1 = function(a_) {
 return !b_.hasOwnProperty(a_) ? '!' : '(' + b_[a_] + ')';
};
var f_2 = function(b_){
 return ['('+i+++')'].concat(a.map(f_1)).join('-');
};

var c = [['0'].concat(a).join('|')].concat(b.map(f_2)).join('\n');

console.log(1, c);
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:

0 comments

Add a comment