A better self

Louis M. Pecora pecora at anvil.nrl.navy.mil
Tue Jul 23 07:59:35 EDT 2002


In article <mailman.1027379624.23316.python-list at python.org>, Delaney,
Timothy <tdelaney at avaya.com> wrote:

> On my machine, the results are:
> 
> 2.30967285289 (1)
> 2.14318686404 (2)
> 2.982054833   (3)

[I added the (numbers) above for clarity]

First, thanks for that nice study.  Very interesting.

(1) is using t, x, y, z = v.t, v.x, v.y, v.z

(2) is t = v.t;  x = v.x;   y = v.y;  z = v.z

(3) a function call to a formula  f(v.t, v.x, v.y, v.z)

It looks like some of the guesses people had on this NG are correct. 

(2) is fastest
(1) is slower   (by ~  8%)
(3) is slowest  (by ~  40%)

I'd call (1) and (2) a near draw, but (3), if it accurately reflects a
function call has non-negligible overhead, IMO.  I understand these
were quick and dirty tests.  More tests would be nicer.  I may try a
few.  Thanks, again.

-- 
Lou Pecora
  - My views are my own.



More information about the Python-list mailing list