[ENH][VM] primitiveCopyObject

Andreas Raab andreas.raab at gmx.de
Fri Dec 5 20:29:11 UTC 2003


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

 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CopyObject.2.cs
Type: application/octet-stream
Size: 2406 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20031205/3d1cbfa5/CopyObject.2.obj


More information about the Squeak-dev mailing list