Fast list filter by removing list from dom during filter

JavaScript performance comparison

Test case created

Preparation code

<script src="//ajax.googleapis.com/ajax/libs/mootools/1.3/mootools-yui-compressed.js"></script>

<script>

window.list = new Element('ul');

document.body.grab(window.list);

for(i = 0; i < 1000; i++) {
window.list.grab(new Element('li', {text: i });
}

</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
No hiding
window.list.getElements('li').each(function(li) {
li.hide();
});
pending…
Hiding
document.body.empty();
window.list.getElements('li').each(function(li) {
li.hide();
});
document.body.grab(window.list);
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