Remove vs. Hide

JavaScript performance comparison

Revision 2 of this test case created by Alex Kahn

Preparation code

<script src=""></script>

<div id="remove-me"></div>
<div id="hide-me"></div>

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

Compare results of other browsers


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:

1 comment

Mathias Bynens commented :

The problem is you’re trying to remove and hide the same element over and over again. Once an element is removed, it is removed; after that, calling .remove() won’t actually do anything anymore. The same goes for .hide().

To make a fair comparison, you should reinsert the removed element and .show() the hidden element before running every test. I did something similar in revision #3 of this test case.

Comment form temporarily disabled.

Add a comment