convert HTML collection into array
JavaScript performance comparison
Preparation code
<div id="parent">
</div>
<script>
Benchmark.prototype.setup = function() {
var parentNode = document.getElementById('parent');
for (var i = 0, length = 100; i < length; i++) {
var child = document.createElement('div');
parentNode.appendChild(child);
}
var objs = parentNode.getElementsByTagName('div');
};
</script>
Preparation code output
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
HTML collection |
|
pending… |
convert HTML collection into Array |
|
pending… |
convert HTML collection into Array with Array.slice |
|
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:
- Revision 1: published
- Revision 2: published
- Revision 3: published by convert HTML collection into array 2
- Revision 4: published by Cong Liu
- Revision 6: published by Cong Liu
- Revision 7: published
- Revision 8: published
- Revision 9: published
- Revision 10: published by Cong Liu
0 comments