[Python-Dev] Returning int instead of long from struct when possible for performance

Armin Rigo arigo at tunes.org
Fri May 26 16:38:50 CEST 2006


Hi Bob,

On Thu, May 25, 2006 at 10:58:21PM +0000, Bob Ippolito wrote:
> Python ints are a heck of a lot faster to work with than Python longs  
> and have the additional benefit that psyco <http:// 
> psyco.sourceforge.net> can optimize the hell out of int but can't do  
> anything at all for long.

Alternatively, someone could implement in Psyco longs that are known to
fit in an int, and longs that are known to fit in an unsigned int, and
longs that fit in a C long long, etc...  Given a full range of long
variants, it would be easier and faster to emulate a CPython behavior
where the user-visible return type is consistent.

So, as far as Psyco is concerned I'm -1 on this change.  (I won't deny
its speed and memory benefits to plain CPython, though.)


Armin


More information about the Python-Dev mailing list