Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Cost of destructuring polyfill
http://shortn/_phn0vruuxP
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36
Browser:
Chrome 145
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
2 months ago
Test name
Executions per second
destructureAndNewArray
94036992.0 Ops/sec
polyfilledDestructureAndNewArray
35106484.0 Ops/sec
newArray
95292880.0 Ops/sec
mutateArray
96536832.0 Ops/sec
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
function signal() { var a = Math.random(), b = Math.random(); return [ function () { return a; }, function () { return b; }, ]; } function wrap(a) { return function () { console.log("start"); var b = a(); console.log("end"); return b; }; } function destructureAndNewArray() { const [get, set] = signal(); return [wrap(get), wrap(set)]; } function c(a) { var b = 0; return function () { return b < a.length ? { done: !1, value: a[b++] } : { done: !0 }; }; } function polyfilledDestructureAndNewArray() { var a = signal(); var b = typeof Symbol != "undefined" && Symbol.iterator && a[Symbol.iterator]; if (b) a = b.call(a); else if (typeof a.length == "number") a = { next: c(a) }; else throw Error(String(a) + " is not an iterable or ArrayLike"); b = a; a = b.next().value; b = b.next().value; return [wrap(a), wrap(b)]; } function newArray() { var a = signal(); return [wrap(a[0]), wrap(a[1])]; } function mutateArray() { var a = signal(); a[0] = wrap(a[0]); a[1] = wrap(a[1]); return a; }
Tests:
destructureAndNewArray
destructureAndNewArray();
polyfilledDestructureAndNewArray
polyfilledDestructureAndNewArray();
newArray
newArray();
mutateArray
mutateArray();