Map() delete while iterating vs clear (version: 0)
When iterating over a Map and clearing after iteration is required, is it faster to remove items at each iteration step or is it faster to iterate and then clear() the entire Map afterwards?
Comparing performance of: Iterate + clear vs Iterate + delete
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
Iterate + clear
Iterate + delete
Fastest:N/A
Slowest:N/A
Latest run results:
Run details: (Test run date:
9 days ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36