dojo_test array mixin vs clone vs map

JavaScript performance comparison

Revision 4 of this test case created

Preparation code

<script src="//ajax.googleapis.com/ajax/libs/dojo/1.9.1/dojo/dojo.js">
</script>
 
<script>
Benchmark.prototype.setup = function() {
    var test = [{
      "defaultVal": "",
      "label": "",
      "value": ""
    }, {
      "defaultVal": "",
      "label": "Abadia de Goias",
      "value": "GO_0"
    }, {
      "defaultVal": "",
      "label": "Abadia dos Dourados",
      "value": "MG_0"
    }, {
      "defaultVal": "",
      "label": "Abadiania",
      "value": "GO_1"
    }, {
      "defaultVal": "",
      "label": "Abaete",
      "value": "MG_1"
    }, {
      "defaultVal": "",
      "label": "Abaetetuba",
      "value": "PA_0"
    }, {
      "defaultVal": "",
      "label": "Abaiara",
      "value": "CE_0"
    }, {
      "defaultVal": "",
      "label": "Abaira",
      "value": "BA_0"
    }, {
      "defaultVal": "",
      "label": "Abare",
      "value": "BA_1"
    }, {
      "defaultVal": "",
      "label": "Abatia",
      "value": "PR_0"
    }, {
      "defaultVal": "",
      "label": "Abdon Batista",
      "value": "SC_0"
    }, {
      "defaultVal": "",
      "label": "Abel Figueiredo",
      "value": "PA_1"
    }, {
      "defaultVal": "",
      "label": "Abelardo Luz",
      "value": "SC_1"
    }, {
      "defaultVal": "",
      "label": "Abre-Campo",
      "value": "MG_2"
    }, {
      "defaultVal": "",
      "label": "Abreu e Lima",
      "value": "PE_0"
    }, {
      "defaultVal": "",
      "label": "Abreulandia",
      "value": "TO_0"
    }, {
      "defaultVal": "",
      "label": "Acaiaca",
      "value": "MG_3"
    }, {
      "defaultVal": "",
      "label": "Acailandia",
      "value": "MA_0"
    }, {
      "defaultVal": "",
      "label": "Acajutiba",
      "value": "BA_2"
    }, {
      "defaultVal": "",
      "label": "Acara",
      "value": "PA_2"
    }, {
      "defaultVal": "",
      "label": "Acarape",
      "value": "CE_1"
    }]
};
</script>

Preparation code output

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
mixin
dojo.mixin([], test);
pending…
clone
dojo.clone(test);
pending…
map
dojo.map(test, function(value) {
  return value;
});
pending…
json
JSON.parse(JSON.stringify(test));
pending…
dojo json
dojo.fromJson(dojo.toJson(test))
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