Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
JSON stringify vs slice vs structuredClone vs spread vs Array from
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:131.0) Gecko/20100101 Firefox/131.0
Browser:
Firefox 131
Operating system:
Mac OS X 10.15
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
JSON.stringify
1545941.0 Ops/sec
slice
58888480.0 Ops/sec
Array from
18675066.0 Ops/sec
Spread
33898776.0 Ops/sec
structuredClone
838124.2 Ops/sec
Script Preparation code:
var vertices = [ [1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1], ] var myCopy = null;
Tests:
JSON.stringify
myCopy = JSON.parse(JSON.stringify(vertices));
slice
myCopy = vertices.slice();
Array from
myCopy = Array.from(vertices)
Spread
myCopy = [...vertices]
structuredClone
myCopy = structuredClone(vertices)