inline function call

Peter Hansen peter at engcorp.com
Wed Jan 4 16:51:40 EST 2006


Riko Wichmann wrote:
> the difference between running with and without psyco is about a factor 
> 3 for my MC simulation. 

> A factor 3 I consider worthwhile, especially since it doesn't really 
> cost you much.

Definitely.  "import psyco; psyco.full()" is pretty hard to argue 
against. :-)

> The final code snipplet is attached. However, it is essentially 
> unchanged compared to the piece I posted earlier which already had most 
> of the global namespace look-up removed. Taking care of sqrt and random 
> as you suggested didn't improve much anymore. So it's probably not that 
> educational afterall.

Seeing what others have achieved is always educational to the ignorant, 
so I learned something. ;-)

I suspect using psyco invalidates a number of the typical Python 
optimizations, and localizing global namespace lookups with default 
variable assignments is probably one of them.

Thanks for posting.
-Peter




More information about the Python-list mailing list