Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Clean up strategy test 2
(version: 1)
Comparing performance of:
Clean by half vs Clean one by one
Created:
one year ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
var i = 0, MAX_SIZE = 10, a; var loop = 1000 var map = new Map(); for (i = 0; i < MAX_SIZE; i++) { map.set(i, i); }
Tests:
Clean by half
/*When writing async/deferred tests, use `deferred.resolve()` to mark test as done*/ for (i = MAX_SIZE; i < loop; i++) { map.set(i, i); if (map.size >= MAX_SIZE) { let count = MAX_SIZE / 2; for (const key of map.keys()) { map.delete(key); count--; if (count <= 0) { break; } } } }
Clean one by one
/*When writing async/deferred tests, use `deferred.resolve()` to mark test as done*/ for (i = MAX_SIZE; i < loop; i++) { map.set(i, i); if (map.size >= MAX_SIZE) { const firstKeyIt = map.keys().next() if(!firstKeyIt.done) { map.delete(firstKeyIt.value) } } }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Clean by half
Clean one by one
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36
Browser/OS:
Chrome 133 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Clean by half
13474.2 Ops/sec
Clean one by one
10849.3 Ops/sec
Related benchmarks:
Test map size
map length
Map get VS Map has get part 2
Map get VS Map has get part 3
JS Map get VS JS Map has
flatmap vs reduce t
flatmap vs reduce t2
Clean up strategy
Clean up strategy test
Comments
Confirm delete:
Do you really want to delete benchmark?