> in traditional Sun javac, you get something that basically looks like:
>
> for (int i=0; i<1000; i++) {
> if i outside of arr bounds, throw exception
> acc += arr[i];
> }
>
> but the IBM compiler will lift this out (under certain
> circumstances -- for instance, if 'acc' is not in scope of
> the catch) to:
>
> if 0 outside of arr bounds || 999 outside of arr bounds,
> throw exception
> for (int i=0; i<1000; i++) {
> // look ma, no checks
> acc += arr[i];
> }
>
> does GHC do anything similar to this, or are we getting hit
> with array checks at each and every read/write (modulo, of
> course, full laziness)?
No, we don't do anything that clever. Some of the bulk array operations
are written in such a way to eliminate obviously-true bound checks (eg.
listArray doesn't do a bound check for every element), but that's about
it.
Cheers,
Simon
_______________________________________________
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users