Math optimization

Dan Bishop danb_83 at yahoo.com
Sun Sep 22 00:36:04 EDT 2002


jepler at unpythonic.net wrote in message news:<mailman.1032645989.8709.python-list at python.org>...
> Did you bother benchmarking?  I'd be surprised to see a huge difference,
> since the overhead of the bytecode loop should be much much greater than
> the cost of a single division operation.

There is a very slight difference.  On my PC,

a / 2.0 takes 824 ns
a * 0.5 takes 784 ns



More information about the Python-list mailing list