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
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))
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
Test name
Executions per second
Set spread
1218218.4 Ops/sec
Array from set
427481.7 Ops/sec
Filter with set
1233379.2 Ops/sec
Related benchmarks:
Unique
Set vs Filter for unique
Set vs Filter vs includes+push for unique
Set vs Filter for unique 40k
Set vs Filter for unique for me
Set vs Good 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?