Python very slow on the Sharp Zaurus - any idea why?

Tim Peters tim.one at comcast.net
Mon Jul 22 14:44:53 EDT 2002


[Anders J. Munch]
> Python uses floating point to check for integer arithmetic overflow.

[Bernhard Herzog]
> Not any more. This change was introduced in 2.1 IIRC.

This is complicated.  First, scratch "integer arithmetic overflow", because
it's too broad.  Only integer multiplication is relevant here.

Python used to use float arithmetic to detect int mult overflow, but that
didn't work correctly on some 64-bit boxes.

It got replaced by over 100(!) lines of all-integer int mult
overflow-checking code, and I believe that's still in 2.1.3.

But that had an obscure endcase bug too, and it get replaced in 2.2 by a new
float method that doesn't make unwarranted assumptions about the relative
sizes of C longs and C doubles, and usually gets out quickly -- provided
float arithmetic isn't pig slow.

And that's where things stand in current CVS Python too.






More information about the Python-list mailing list