Monte Carlo Method and pi
peter at engcorp.com
Tue Jul 13 14:14:41 CEST 2004
Tim Hochberg wrote:
> beliavsky at aol.com wrote:
>> Does it make two calls to sin()? There is a performance hit for 'y =
>> when not using Psyco.
> It appears that it does not make this optimization. I suppose that's not
> suprising since my understanding is that Psyco generates really simple
> machine code.
I suppose technically, since this is Python, two consecutive calls
to sin(x) could easily return different values... It would be
insane to write code that did this, but the dynamic nature of
Python surely allows it and it's even possible such a dynamic
substitution would be of value (or even improve performance) in
some other situations.
More information about the Python-list