fill template

JavaScript performance comparison

Test case created by nilcolor

Preparation code

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

<table>
<tr id="row">
  <th>
    <a href="" class="action link show"></a>
  </th>
  <td></td>
  <td></td>
</tr></table>

 
<script>
Benchmark.prototype.setup = function() {
    collection = [
      {
        "id" : 1,
        "iso_number" : "6**",
        "iso_code" : "RUB",
        "name" : "Российский рубль"
      },
      {
        "id" : 2,
        "iso_number" : "840",
        "iso_code" : "USD",
        "name" : "Доллар США"
      },
      {
        "id" : 3,
        "iso_number" : "222",
        "iso_code" : "EUR",
        "name" : "Евро"
      },
      {
        "id" : 4,
        "iso_number" : "0",
        "iso_code" : "ISO",
        "name" : "NAME"
      }
    ]
};
</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
current
$.each(collection, function(idx, model){
  row = $("#row");
  row.find('a').text(model['iso_code']).attr('href', "#");
  row.find('td:eq(0)').text(model['iso_number'])
  .next().text(model['name']);
})
pending…
all nexts
$.each(collection, function(idx, model){
  row = $("#row");
  row.find('th')
  .find('a').text(model['iso_code']).attr('href', "#").end()
  .next().text(model['iso_number'])
  .next().text(model['name']);
})
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