Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Array from Set vs setToArray (from lodash)
(version: 1)
Comparing performance of:
Array from Set vs lodash setToArray
Created:
one year ago
by:
Guest
Jump to the latest result
Script Preparation code:
const arr = ['Jane', 'Bob', 'Kat', 'Kat', 'Bob', 'Jane', 'Ian', 'Jane', 'Bob', 'Kat', 'Kat', 'Bob', 'Jane', 'Ian']; const set = new Set(arr); function setToArray(set) { var index = -1, result = Array(set.size); set.forEach(function(value) { result[++index] = value; }); return result; }
Tests:
Array from Set
Array.from(set)
lodash setToArray
setToArray(set)
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Array from Set
lodash setToArray
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/134.0.0.0 Safari/537.36 Edg/134.0.0.0
Browser/OS:
Chrome 134 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Array from Set
30733192.0 Ops/sec
lodash setToArray
12541306.0 Ops/sec
Related benchmarks:
lodash vs native foreach 1
recreate array vs set
iterate over array
Set vs array add
DDS Array vs Set - performance v4
JS test gareko hai
JS test gareko hai 2
Set replace
Array from Set vs lodash setToArray
Comments
Confirm delete:
Do you really want to delete benchmark?