Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Freezing objects and arrays
(version: 1)
Comparing performance of:
Freeze arrays vs Arrays vs Freeze objects vs Objects
Created:
9 months ago
by:
Registered User
Jump to the latest result
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
/*your preparation JavaScript code goes here To execute async code during the script preparation, wrap it as function globalMeasureThatScriptPrepareFunction, example:*/ async function globalMeasureThatScriptPrepareFunction() { // This function is optional, feel free to remove it. // await someThing(); } const store = { _: null }; function do_not_optimize(v) { store._ = v; }
Tests:
Freeze arrays
let x = Object.freeze([1, 2, 3, 4, 5]); do_not_optimize(x);
Arrays
let x = [1, 2, 3, 4, 5]; do_not_optimize(x);
Freeze objects
let x = Object.freeze({ x: 1, y: 2, z: 3, a: 4, b: 5 }); do_not_optimize(x);
Objects
let x = { x: 1, y: 2, z: 3, a: 4, b: 5 }; do_not_optimize(x);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (4)
Previous results
Fork
Test case name
Result
Freeze arrays
Arrays
Freeze objects
Objects
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
9 months ago
)
User agent:
Mozilla/5.0 (X11; Linux x86_64; rv:141.0) Gecko/20100101 Firefox/141.0
Browser/OS:
Firefox 141 on Linux
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Freeze arrays
10493053.0 Ops/sec
Arrays
93661200.0 Ops/sec
Freeze objects
11498658.0 Ops/sec
Objects
104888312.0 Ops/sec
Related benchmarks:
Nullish vs If
JS Variable Performance (const vs let vs var)
Array splice vs. Set delete
Test direct and destructuring performances
Array allocate
Test intArrya
sample normal vs Object.freeze vs Object.seal performance
test slice czourhgirzjgprz
Various ways of object creation
Comments
Confirm delete:
Do you really want to delete benchmark?