Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Array.from new set vs Spread new set vs Array filter with set for unique array
(version: 1)
Comparing performance of:
Set spread vs Array from set vs Filter with set
Created:
one year ago
by:
Guest
Go 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))
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
Set spread
Array from set
Filter with set
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
Filter with set
1.2M/s
Set spread
1.2M/s
Array from set
427K/s
View exact numbers
Test name
Executions per second
✓
Filter with set
1,233,379 Ops/sec
Set spread
1,218,218 Ops/sec
Array from set
427,482 Ops/sec
Related benchmarks
Set vs Filter for unique
Set vs Filter vs forEach for unique
Set vs Filter for unique 2
hash checkl
Comments
Confirm delete:
Do you really want to delete benchmark?