Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Set vs Filter for unique 2
(version: 1)
Comparing performance of:
Set spread vs Array from set vs Filter
Created:
one year ago
by:
Guest
Jump to the latest result
Script Preparation code:
var array = Array.from({length: 10}, () => 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
const b = array.filter((i,index) => array.indexOf(i)=== index)
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
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36
Browser/OS:
Chrome 108 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Set spread
957113.9 Ops/sec
Array from set
555341.2 Ops/sec
Filter
3155825.0 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 with 10000 items
Set vs Filter for unique for me
Diff size Set vs Filter for unique
Set vs Good Filter for unique
Set vs Filter vs forEach for unique
Comments
Confirm delete:
Do you really want to delete benchmark?