Create and append/remove versus display:block/display:none (version: 0)
By writing javascript web applications It is often common the need to show or hide elements like a div according to the user actions. Is it better to do this by creating and appending the node when it is needed or to create the node on the application start and then just display or hide it?
This benchmark is a performance test of this particular use case.
Comparing performance of: Create and append/remove vs display:block/display:none
Memory measurements supported only in Chrome.
For precise memory measurements Chrome must be launched with --enable-precise-memory-info flag.
More information: Monitoring JavaScript Memory
Test case name
Result
Create and append/remove
display:block/display:none
Fastest:N/A
Slowest:N/A
Latest run results:
Run details: (Test run date:
3 years ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36