<div dir="ltr">Hi.<div><br></div><div>I compared performance between object instantiation and object cloning. I was wondering that instantiation almost twice faster than clone (primitive 70 vs 148).</div><div><br></div><div>Could you explain why it like that and could it be improved?<br></div><div><br></div><div>I was think that new object construction is much complex because it requires to fill all object fields (header structure and etc).</div><div>And I was think that copy is just simple function like memcpy which just copy bytes without any logic.</div><div><br></div><div>Here is my code:</div><div><br></div><div><div>object := Object new.</div><div>3 timesRepeat: [ Smalltalk garbageCollect ].</div><div>result1 := [ Object basicNew ] benchFor: 10 seconds.</div><div>3 timesRepeat: [ Smalltalk garbageCollect ].</div><div>result2 := [ object shallowCopy ] benchFor: 10 seconds.</div><div>{result1. result2}.</div><div> &quot;an Array(a BenchmarkResult(518,021,045 iterations in 10 seconds 2 milliseconds. 51,791,746 per second) a BenchmarkResult(302,807,253 iterations in 10 seconds 4 milliseconds. 30,268,618 per second))&quot; </div></div><div><br></div><div>(I run it on latest Pharo on Mac SpurVM)</div><div><br></div><div>Best regards,</div><div>Denis</div></div>