[ENH] FasterDistance-spfa
Stéphane Rollandin
lecteur at zogotounga.net
Sat Nov 6 17:48:40 UTC 2004
... sorry, the previous changeset will mess up the Point methods
categories.
use the one attached here instead !
Stef
> from preamble:
>
> "Change Set: FasterDistance-spfa
> Date: 6 November 2004
> Author: Stephane Rollandin
>
> The implementation of Point>>dist: is very indirect. This simple rewrite
> make it faster by almost 20%"!
>
-------------- next part --------------
'From Squeak3.8alpha of ''17 July 2004'' [latest update: #5987] on 6 November 2004 at 6:38:21 pm'!
"Change Set: FasterDistance-spfa
Date: 6 November 2004
Author: Stephane Rollandin
The implementation of Point>>dist: is very indirect. This simple rewrite make it faster by almost 20%"!
!Point methodsFor: 'point functions' stamp: 'spfa 11/6/2004 16:01'!
dist: aPoint
"Answer the distance between aPoint and the receiver."
| dx dy |
dx _ aPoint x - x.
dy _ aPoint y - y.
^ ((dx * dx) + (dy * dy)) sqrt! !
More information about the Squeak-dev
mailing list
|