Language Shootout
David C. Ullrich
ullrich at math.okstate.edu
Thu Jul 12 10:10:46 EDT 2001
On Wed, 11 Jul 2001 08:49:49 -0700, Jeff Shannon <jeff at ccvcorp.com>
wrote:
>
>
>"David C. Ullrich" wrote:
>
>> On Wed, 11 Jul 2001 01:47:30 GMT, bokr at accessone.com (Bengt Richter)
>> wrote:
>>
>> >[18:47] C:\pywk\fib>strL.py str 10L**20899
>> >str took 13.601617 seconds
>> >
>> >[18:47] C:\pywk\fib>strL.py strL 10L**20899
>> >strL took 1.044989 seconds
>> >
>> >Recursion rides again ;-)
>>
>> Recursive or not, the idea that we can write
>> a replacement for str that's faster is very
>> curious.
>
>How much of this difference in speed, though, is because strL()
>is a special purpose integer->string conversion, where the
>standard str() is a general-purpose anything->string conversion?
Surely almost none of it! I don't know anything about the
internal representation of Python objects, but I tend to
doubt it takes more than a tick or two for str() to determine
that the argument is a long and call the appropriate
long->string code.
>Jeff Shannon
>Technician/Programmer
>Credit International
>
>
>
David C. Ullrich
More information about the Python-list
mailing list