Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Filtering test LZ
(version: 0)
Comparing performance of:
Set spread vs Array from set vs Filter
Created:
2 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
var array = Array.from({length: 40}, () => ({ value: Math.floor(Math.random() * 140)}));
Tests:
Set spread
const values = array.map(({ value }) => value) const f = [... new Set(values)]
Array from set
const values = array.map(({ value }) => value) 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:
2 years ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
Browser/OS:
Chrome 119 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Set spread
1462627.0 Ops/sec
Array from set
999646.1 Ops/sec
Filter
539023.6 Ops/sec
Related benchmarks:
slice vs filter
Unique values of array
slice vs filter more than 1000
slice vs filter 2
slice vs filter23
Comments
Confirm delete:
Do you really want to delete benchmark?