Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
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 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Mobile Safari/537.36
Browser:
Chrome Mobile 122
Operating system:
Android
Device Platform:
Mobile
Date tested:
2 years ago
Benchmark engine:
Benchmark.js
slice
847K/s
Spread
840K/s
Array from
500K/s
JSON.stringify
109K/s
structuredClone
52K/s
View exact numbers
Test name
Executions per second
✓
slice
847,182 Ops/sec
Spread
840,468 Ops/sec
Array from
500,215 Ops/sec
JSON.stringify
108,933 Ops/sec
structuredClone
51,909 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)