Hans Aberg <[EMAIL PROTECTED]> writes:

> At 09:35 +0100 98/09/15, Simon Marlow wrote:
> >I don't think the overflow checks will be particularly expensive.
> >After all, it's just a test/branch sequence, with the branch not taken
> >in the common case.  This is dwarfed by the costs of boxing/unboxing,
> >heap checks, and testing whether each object is a small or large
> >integer.
> 
>   One wants a type that for small numbers (fitting into a word) avoids
> those other costs you are mentioning. Then the main cost is due to those
> checks, and it becomes expensive relative to the Int, as it is then on such
> a low level.

The other costs are mainly due to having a lifted Integer type, and
are the same for Int.  The penalties for lifting far outweigh an extra
couple of instructions for the overflow check (which probably get
swallowed up in the pipeline anyway).

For intensive strict numeric algorithms you might notice the
difference, but in general I bet the effect would be negligible.

Cheers,
        Simon

-- 
Simon Marlow                                             [EMAIL PROTECTED]
University of Glasgow                       http://www.dcs.gla.ac.uk/~simonm/
finger for PGP public key


Reply via email to