[Vm-dev] Re: A trick to speedup #become: (but not becomeForward:)
andreas.raab at gmx.de
Sun Jul 31 08:32:11 UTC 2011
On 7/31/2011 6:56, Igor Stasenko wrote:
> And it works! All become tests are green.
> See attached for VM and image side code.
Good idea. But your benchmark is a little off:
> Now most interesting thing. How much speed we gain?
> | x y |
> x := 'ab' copy.
> y := 'cd' copy.
> [ 100 timesRepeat: [ x become: y ] ] timeToRun
x and y should be young in the above and the performance of #become
should be much faster than when they are old. To wit:
[ 100 timesRepeat: [ 'ab' copy become: 'cd' copy ] ] timeToRun
| x y |
x := 'ab' copy.
y := 'cd' copy.
Smalltalk garbageCollect. "make x and y old"
[ 100 timesRepeat: [ x become: y ] ] timeToRun
So I'm not sure how valid your benchmark really is.
More information about the Vm-dev