Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
assign vs ...
(version: 0)
Comparing performance of:
clone: assign vs clone: ... vs modify: assign vs reassign: ... vs clone: ... with first {} vs reassign: ... with first {}
Created:
3 years ago
by:
Registered User
Jump to the latest result
Tests:
clone: assign
const empty = {}; const n = 30; const obj1 = {}; for(let i = 0; i < n; i++) obj1[`o1-${i}`] = i; const obj1_1 = {}; for(let i = 0; i < n; i++) obj1_1[`o1-${i}`] = i; const obj2 = {}; for(let i = 0; i < n; i++) obj2[`o2-${i}`] = i; const obj3 = {}; for(let i = 0; i < n; i++) obj3[`o3-${i}`] = i; const a = Object.assign({}, obj1, obj2, obj3);
clone: ...
const empty = {}; const n = 30; const obj1 = {}; for(let i = 0; i < n; i++) obj1[`o1-${i}`] = i; const obj1_1 = {}; for(let i = 0; i < n; i++) obj1_1[`o1-${i}`] = i; const obj2 = {}; for(let i = 0; i < n; i++) obj2[`o2-${i}`] = i; const obj3 = {}; for(let i = 0; i < n; i++) obj3[`o3-${i}`] = i; const a = { ...obj1, ...obj2, ...obj3 };
modify: assign
const empty = {}; const n = 30; const obj1 = {}; for(let i = 0; i < n; i++) obj1[`o1-${i}`] = i; const obj1_1 = {}; for(let i = 0; i < n; i++) obj1_1[`o1-${i}`] = i; const obj2 = {}; for(let i = 0; i < n; i++) obj2[`o2-${i}`] = i; const obj3 = {}; for(let i = 0; i < n; i++) obj3[`o3-${i}`] = i; const o = JSON.parse(JSON.stringify(obj1_1)); Object.assign(o, obj1, obj2, obj3);
reassign: ...
const empty = {}; const n = 30; const obj1 = {}; for(let i = 0; i < n; i++) obj1[`o1-${i}`] = i; const obj1_1 = {}; for(let i = 0; i < n; i++) obj1_1[`o1-${i}`] = i; const obj2 = {}; for(let i = 0; i < n; i++) obj2[`o2-${i}`] = i; const obj3 = {}; for(let i = 0; i < n; i++) obj3[`o3-${i}`] = i; let o = JSON.parse(JSON.stringify(obj1_1)); o = { ...o, ...obj1, ...obj2, ...obj3 };
clone: ... with first {}
const empty = {}; const n = 30; const obj1 = {}; for(let i = 0; i < n; i++) obj1[`o1-${i}`] = i; const obj1_1 = {}; for(let i = 0; i < n; i++) obj1_1[`o1-${i}`] = i; const obj2 = {}; for(let i = 0; i < n; i++) obj2[`o2-${i}`] = i; const obj3 = {}; for(let i = 0; i < n; i++) obj3[`o3-${i}`] = i; const a = { ...{}, ...obj1, ...obj2, ...obj3 };
reassign: ... with first {}
const empty = {}; const n = 30; const obj1 = {}; for(let i = 0; i < n; i++) obj1[`o1-${i}`] = i; const obj1_1 = {}; for(let i = 0; i < n; i++) obj1_1[`o1-${i}`] = i; const obj2 = {}; for(let i = 0; i < n; i++) obj2[`o2-${i}`] = i; const obj3 = {}; for(let i = 0; i < n; i++) obj3[`o3-${i}`] = i; let o = JSON.parse(JSON.stringify(obj1_1)); o = { ...{}, ...o, ...obj1, ...obj2, ...obj3 };
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (6)
Previous results
Fork
Test case name
Result
clone: assign
clone: ...
modify: assign
reassign: ...
clone: ... with first {}
reassign: ... with first {}
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Autogenerated LLM Summary
(model
llama3.2:3b
, generated one year ago):
It seems like you're providing benchmark results in JSON format. To summarize the benchmark results: 1. The top 2 tests are: * `clone: ...` (Chrome 103, Desktop, Mac OS X 10.15.7) with execution times of 57669.5703125 and 56546.72265625 seconds respectively. * `reassign: ...` (Chrome 103, Desktop, Mac OS X 10.15.7) with execution times of 49032.16796875 and 45904.80078125 seconds respectively. 2. The other tests are: * `clone: assign` with an execution time of 12347.3173828125 seconds. * `reassign: ...` with an execution time of 12347.3173828125 seconds. * `modify: assign` with an execution time of 50175.95703125 seconds. Please let me know what specific information you need from these results or how I can assist you further!
Related benchmarks:
lodash.assign vs object.assign vs spread
Object.assign vs direct copy
assign vs set
Object.assign() vs Reflect.set()
JavaScript: Normal assignation VS Object.assign
Comments
Confirm delete:
Do you really want to delete benchmark?