Strange performance artifacts

Daniel Vainsencher danielv at netvision.net.il
Sun Aug 16 04:11:54 UTC 1998


Sorry, forgot to mention, I *was* performing the task numerous times.

The run times were ~260 for the version including the assignment, 600 without it,
(and ~350 with the traditional code I was using before).

Any other ideas?

*********** REPLY SEPARATOR ***********

On 8/15/98, at 10:15 AM, Dan Ingalls wrote:

>Daniel -
>
>>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?
>
>My first conjecture is that you are below the resolution of the millisecond clock.
>
>I would try...
>
>A) Time millisecondsToRun: [1 to: 1000 do: [:i | firstPoint transformBy: rotationPoint]].
>B) Time millisecondsToRun: [1 to: 1000 do: [:i |  ignored _ firstPoint transformBy: rotationPoint]].





More information about the Squeak-dev mailing list