[pypy-dev] Re: Ints vs Longs

Michael Hudson mwh at python.net
Mon Oct 13 12:58:33 CEST 2003

Florian Schulze <florian.proff.schulze at gmx.net> writes:

> On Mon, 13 Oct 2003 10:58:14 +0100, Michael Hudson <mwh at python.net> wrote:
>> Florian Schulze <florian.proff.schulze at gmx.net> writes:
>>> I just wondered what happens when ints overflow.
>> In PyPy, um, I'm not sure :-) We don't have a long type in the
>> StdObjSpace yet, so I guess you'll get an overflow error.
>>> This question also applies to Psyco.
>> Psyco correctly detects overflow and returns a long.
>> For mulitplication, at least, this is easier in machine code than C...
> That's because there is an overflow flag ;)

Exactly :-)

>>> Is a long returned? How much of a speed penalty does occure due to
>>> this?
>> I don't know.  It's probably quite substantial.
> Hmm, now that you mentioned that Psyco uses machinecode, I think the
> penalty is not *that* high. It depends on how well the processor
> handles the branching, I guess.

Ah, I thought you were asking about how much overhead occurred when
there *was* an overflow.  That could be substantial, as I don't think
psyco knows very much about longs (could be wrong, though).

The overhead of checking for overflow is, as you say, probably not
that high.  I don't know enough about the x86 architecture to say


  Or if you happen to be resigned to the size of your trouser
  snake and would rather not be reminded of it, training a shared
  classifier to reject penis-enlargement spam stops Barry from
  getting the help he so desperately needs.  -- Tim Peters, c.l.python

More information about the Pypy-dev mailing list