Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
set.add test4
(version: 0)
Comparing performance of:
set vs arr
Created:
2 years ago
by:
Guest
Jump to the latest result
Tests:
set
const set = new Set() const getStr = () => Math.random().toString(36).slice(2, 10); for (let i = 0; i < 10000; i++) { const val = getStr() set.add(val) set.has(val) }
arr
const arr = [] let check = 0 const getStr = () => Math.random().toString(36).slice(2, 10); for (let i = 0; i < 10000; i++) { const val = getStr() arr.push(val) if (i > 10) check++ arr.includes(arr[check]) }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
set
arr
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Related benchmarks:
Updating Classes v1
setAttribute vs classList.add (attribute adding)
Comparison of setting style via different methods
setAttribute vs classList.add (attribute adding) V2
className vs. setAttribute vs. classList v4
Comments
Confirm delete:
Do you really want to delete benchmark?