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
Go 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
Filter
3.2M/s
Set spread
957K/s
Array from set
555K/s
View exact numbers
Test name
Executions per second
✓
Filter
3,155,825 Ops/sec
Set spread
957,114 Ops/sec
Array from set
555,341 Ops/sec
Related benchmarks
Set vs Filter for unique
Set vs Filter vs forEach for unique
Comments
Confirm delete:
Do you really want to delete benchmark?