Speed of str(positive_integer)..

alejandro david weil aweil at mail.ru
Tue Jun 29 04:15:04 CEST 2004

On Mon June 28 2004 21:22, Christopher T King wrote:
> 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

But both versions with and without divmod uses the same list lookup (
or there's something that i didn't see..).

> 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.

If it's ability is to use fpu, it's ok that fails.. but, for integers it can
use standard i286 div instruction set (well I tried it only in x86, and also,
I think that Psyco works only there, so, it should be supposed from begining),
with does the same.

+ There is no dark side of the moon really. Matter of fact it's all dark.

More information about the Python-list mailing list