[ENH][VM] primitiveCopyObject
Avi Bryant
avi at beta4.com
Fri Dec 5 23:00:59 UTC 2003
On Dec 5, 2003, at 12:29 PM, Andreas Raab wrote:
> Change Set: CopyObject
> Date: 5 December 2003
> Author: Andreas Raab
>
> Introduces a primitiveCopyObject which can be used for (shallow)
> copying
> state from some other object of the same class. This allows for
> efficiently
> 'backing up' and 'restoring' state in some object. For example, one
> can use
> a #clone of the object to get a backup and then use #copyFrom: to
> restore
> the backup.
>
> A benchmark (using PasteUpMorph) shows that the primitive is about 60
> times
> faster than the existing method:
>
> m := PasteUpMorph new.
> [1 to: 100000 do:[:i| copy := m clone. m copyFrom: copy]] timeToRun.
>
> Without primitive: 7055 msecs
> With primitive: 119 msecs
>
>
> <CopyObject.2.cs>
More information about the Squeak-dev
mailing list
|