Strange performance artifacts

Daniel Vainsencher danielv at netvision.net.il
Sat Aug 15 05:22:48 UTC 1998


I've created a new method for point, allowing it's the rotation about the origin using multiplication as a complex number,
as it seemed a reasonably fast way of rotating a single point around a full circle in small fixed increments.

Then I wanted to time it. I don't have the code used here/now, but I used to variations like -

A) Time millisecondsToRun: [ firstPoint transformBy: rotationPoint].
B) Time millisecondsToRun: [ firstPoint _ firstPoint transformBy: rotationPoint].

Now, B was gratifyingly faster than the code I'd used earlier (by some 30%, and much more amenable to going primitive).
But what cought my eye and got me very perplexed was that A was around twice as *slow* as B.

That is to say, for some reason the added assignment made code much faster. (?!?!?!).

Ideas why this might be anyone?

Daniel Vainsencher





More information about the Squeak-dev mailing list