Performance of int/long in Python 3

Dan Stromberg drsalists at gmail.com
Tue Mar 26 01:12:10 CET 2013


On Mon, Mar 25, 2013 at 4:35 PM, Cousin Stanley <cousinstanley at gmail.com>wrote:

>
> Chris Angelico wrote:
>
> > The Python 3 merge of int and long has effectively penalized
> > small-number arithmetic by removing an optimization.
> > ....
> > The cost is clear.
> > ....
>

I thought I heard that Python 3.x will use machine words for small
integers, and automatically coerce internally to a 2.x long as needed.

Either way, it's better to have a small performance cost to avoid problems
when computers move from 32 to 64 bit words, or 64 bit to 128 bit words.
 With 3.x int's, you don't have to worry about a new crop of CPU's breaking
your code.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20130325/ec03e28b/attachment.html>


More information about the Python-list mailing list