Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Writing to objects - Seal vs Unsealed
(version: 3)
Comparing performance of:
Sealed vs Unsealed
Created:
8 months ago
by:
Registered User
Jump to the latest result
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
function new_struct() { return { a : Math.random(), b : Math.random(), c : Math.random(), d : Math.random(), }; } var structs1 = new Array(10000); var structs2 = new Array(10000); var new_values = new Array(10000) for (let i = 0; i < 10000; i++) { structs1[i] = new_struct(); structs2[i] = Object.seal(Object.assign(new_struct(), structs1[i])); new_values[i] = new_struct(); }
Tests:
Sealed
for (let i = 0; i < structs1.length; i++) { structs1[i].a = new_values[i].a; structs1[i].b = new_values[i].b; structs1[i].c = new_values[i].c; structs1[i].d = new_values[i].d; }
Unsealed
for (let i = 0; i < structs2.length; i++) { structs2[i].a = new_values[i].a; structs2[i].b = new_values[i].b; structs2[i].c = new_values[i].c; structs2[i].d = new_values[i].d; }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Sealed
Unsealed
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
8 months ago
)
User agent:
Mozilla/5.0 (X11; Linux x86_64; rv:142.0) Gecko/20100101 Firefox/142.0
Browser/OS:
Firefox 142 on Linux
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Sealed
17184.9 Ops/sec
Unsealed
20263.3 Ops/sec
Related benchmarks:
Object vs Object.seal
Constructor vs object literal 2
noop function call vs conditional
func vs object vs symbol
public vs private vs symbol
Function argument deconstructing
Sealed object access vs ordinary object access
Frozen object access vs ordinary object access
Reading from objects - Seal vs Unsealed
Comments
Confirm delete:
Do you really want to delete benchmark?