Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
array.toSorted vs structuredClone
(version: 1)
Which is faster for cloning?
Comparing performance of:
array.toSorted vs sturcturedClone
Created:
one year ago
by:
Guest
Go to the latest result
Script Preparation code:
var array = Array.from({ length: 10_000 }).map((_) => Math.random()); var compareFn = (a, b) => a - b
Tests:
array.toSorted
const result = array.toSorted(compareFn)
sturcturedClone
const result = structuredClone(array).sort(compareFn)
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
array.toSorted
sturcturedClone
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/137.0.0.0 Safari/537.36
Browser/OS:
Chrome 137 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
array.toSorted
633/s
sturcturedClone
552/s
View exact numbers
Test name
Executions per second
✓
array.toSorted
633 Ops/sec
sturcturedClone
552 Ops/sec
Related benchmarks
Array clone (spread vs slice vs array.from)
shallow clone object vs map copy vs strucutredClone
Comments
Confirm delete:
Do you really want to delete benchmark?