[Patches] [ python-Patches-1334979 ] Fix for int(string, base) wrong answers

SourceForge.net noreply at sourceforge.net
Sun Feb 19 13:52:32 CET 2006


Patches item #1334979, was opened at 2005-10-22 18:44
Message generated for change (Comment added) made by birkenfeld
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1334979&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Core (C code)
Group: None
>Status: Closed
>Resolution: Duplicate
Priority: 5
Submitted By: Adam Olsen (rhamphoryncus)
Assigned to: Nobody/Anonymous (nobody)
Summary: Fix for int(string, base) wrong answers

Initial Comment:
Fix for Bug #1334662.  Passes make test (other than
skipped tests), as well as the errors listed in Bug
#1334662.

Although it does remove the division from the loop this
does not seem to make a signifigant speedup.  No clue why.

----------------------------------------------------------------------

>Comment By: Georg Brandl (birkenfeld)
Date: 2006-02-19 13:52

Message:
Logged In: YES 
user_id=1188172

Superseded by patch #1335972.

----------------------------------------------------------------------

Comment By: Adam Olsen (rhamphoryncus)
Date: 2005-10-22 22:00

Message:
Logged In: YES 
user_id=12364

This one moves smallmax into a precomputed global table.

$ python2.4 -m timeit 'int("999999999")'
1000000 loops, best of 3: 0.863 usec per loop
$ python2.4 -m timeit 'int("9")'
1000000 loops, best of 3: 0.716 usec per loop
$ ./python -m timeit 'int("999999999")'
1000000 loops, best of 3: 0.766 usec per loop
$ ./python -m timeit 'int("9")'
1000000 loops, best of 3: 0.694 usec per loop

So 0.863 -> 0.766 and 0.716 -> 0.694.  11% and 3%.  I
wouldn't bother if it weren't fixing a bug, but maybe the
http://spoj.sphere.pl test will show a larger difference.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1334979&group_id=5470


More information about the Patches mailing list