Create and append/remove versus display:block/display:none (improved) (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.
In this version, the createAppendDiv was isolated from operations that can be done once, so the test executes just the operations that are really essencial for the test 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 days ago)
Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Mobile Safari/537.36