David Menendez | 13 Nov 18:55
Gravatar

Re: Inliner behaviour - tiny changes lead to huge performance differences

On Fri, Nov 13, 2009 at 2:04 AM, Bryan O'Sullivan <bos <at> serpentine.com> wrote:
>
> And the lengthI function is defined more generally, in the hope that I could
> use it for both Int and Int64 lengths:
>
> lengthI :: Integral a => Stream Char -> a
> lengthI (Stream next s0 _len) = loop_length 0 s0
>     where
>       loop_length !z s  = case next s of
>                            Done       -> z
>                            Skip    s' -> loop_length z s'
>                            Yield _ s' -> loop_length (z + 1) s'
> {-# INLINE[0] lengthI #-}

Would it help to SPECIALIZE lengthI for Int and Int64?

--

-- 
Dave Menendez <dave <at> zednenem.com>
<http://www.eyrie.org/~zednenem/>

Gmane