insertCell vs create new TD

JavaScript performance comparison

Test case created by NAIF

Preparation code

<table cellspacing="0">
<tbody>
<tr id="ROW"></tr>
</tbody>
</table>
<script>
Benchmark.prototype.setup = function() {
    var d = document;
    var c = d.getElementById('ROW');
};
</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
insertCell
c.insertCell(-1);
c.firstChild.appendChild(d.createTextNode('1'));
c.removeChild(c.firstChild);
pending…
create TD
var a = d.createElement('td');
a.appendChild(d.createTextNode('1'));
c.appendChild(a);
c.removeChild(c.firstChild);
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