Speed of str(positive_integer)..

Christopher T King squirrel at WPI.EDU
Tue Jun 29 02:22:48 CEST 2004


On Mon, 28 Jun 2004, alejandro david weil wrote:

> *The thrid test is using divmod() that i thought that would be
> faster (i thought it could make only one division and get both
> qoutient and remainder, without having to multiply..) but
> was worse.

> PS: I want a faster divmod! :-)

I was going to say that divmod was slower because it performs float
division instead of the integer division of // (which is true), but I'm
guessing the slowdown comes from the extra dictionary lookup needed for
divmod (unless this is somehow optimized away) instead. If that's indeed
true, then it seems that divmod doesn't adequately perform its intended
purpose, i.e. make use of the FPU's ability to divide and modulusify in
one step to gain speed.




More information about the Python-list mailing list