Speed-up for loops

Antoine Pitrou solipsis at pitrou.net
Mon Sep 6 13:56:39 CEST 2010

On Mon, 06 Sep 2010 13:20:01 +0200
Stefan Behnel <stefan_ml at behnel.de> wrote:
> > (2) Integer arithmetic seems to go straight from 32-bits to long
> > integers; why not use 64-bits before needing long integers?
> You are making assumptions based on Python 2, I guess. Try Python 3.1 or 
> later instead, where the int and long types are unified. Also, the 
> implementation is a bit more complex than you appear to be thinking. Don't 
> forget that it has received serious benchmarking based optimisations.

The optimizations are mainly related to big integer arithmetics,
though. For small ints the main cost is interpretation and
unboxing overhead as always.



More information about the Python-list mailing list