Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
hash checkl
(version: 1)
Comparing performance of:
Set spread vs Array from set vs Filter with set vs Hash object
Created:
one year ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
var array = Array.from({length: 40}, () => Math.floor(Math.random() * 140));
Tests:
Set spread
const f = [... new Set(array)]
Array from set
const s = new Set(array) const l = Array.from(s)
Filter with set
const s = new Set() const b = array.filter((i) => s.has(i) ? false : (s.add(i), true))
Hash object
const s = {} const b = array.filter((i) => s.hasOwnProperty(i) ? false : (s[i] = true))
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (4)
Previous results
Fork
Test case name
Result
Set spread
Array from set
Filter with set
Hash object
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; rv:137.0) Gecko/20100101 Firefox/137.0
Browser/OS:
Firefox 137 on Mac OS X 10.15
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Set spread
1208406.5 Ops/sec
Array from set
1541405.5 Ops/sec
Filter with set
1289463.1 Ops/sec
Hash object
1361531.6 Ops/sec
Related benchmarks:
Unique
Set vs Filter for unique
Filtering test LZ
Set vs Filter vs forEach for unique
Set vs Filter vs forEach vs forLoop for unique
Set vs Filter vs forEach vs forLoop vs forLoop-alt for unique
Set vs Filter vs forEach vs forLoop vs filterWithSet vs map for unique
Set vs Filter for unique 2
Array.from new set vs Spread new set vs Array filter with set for unique array
Comments
Confirm delete:
Do you really want to delete benchmark?