Map and $.each

Benchmark created by None on


Preparation HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

Setup

var data= [["abc","def"],["dss","ddd"]];

Test runner

Ready to run.

Testing in
TestOps/sec
map
var json = data.map(function (value, key) {
    return {
        "wf": value[0],
        "sb": value[1]
    }
});
console.log(json);
ready
each
var b=[];
$.each(a,function(i,d){
  b.push({wf:d[0],sb:d[1]});
});

console.log(b);
ready

Revisions

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