[Haskell-cafe] Possible Improvements
Don Stewart
dons at galois.com
Mon Dec 3 01:10:27 EST 2007
> Fully lazy:
>
> data Tree = Leaf Int | Node Tree Int Tree
>
> $ time ./A 25
> 49
> ./A 25 18.20s user 0.04s system 99% cpu 18.257 total
> ^^^^^^
> 3556K heap use.
>
> Strict in the elements, lazy in the spine:
>
> data Tree = Leaf !Int | Node Tree !Int Tree
>
> $ time ./A 25
> 49
> ./A 25 14.41s user 0.03s system 99% cpu 14.442 total
> ^^^^^^
> 3056K heap use.
And, oh, element strict, with -funbox-strict-fields,
$ time ./A 25
49
./A 25 12.25s user 0.01s system 99% cpu 12.346 total
-- Don
More information about the Libraries
mailing list