FPS, ForeignPtr and GHC 6.6

Donald Bruce Stewart dons at cse.unsw.edu.au
Fri Apr 21 06:09:36 EDT 2006


Just did some benchmarking of FPS with ghc 6.6 from last night.
Most functions seem to have gotten faster (due to the improved ForeignPtr). In particular:

    words           1.583        2.115
    lines           0.028        0.421
    inits           0.777        5.350
    tails           0.836        6.634

All functions that generate many substrings.
Interestingly, unpack seems to have gone backwards.

    unpack          3.319        1.596

So I'll have to look at that. Possibly the fusion tricks are not working?
Happily this now means:

    main = print . length . P.lines =<<  P.hGetContents stdin

now runs at exactly 2x the speed of wc -l :)

    $ time ./a.out < 20M
    314080
    ./a.out < 20M  0.03s user 0.04s system 85% cpu 0.083 total

    pill19$ time wc -l < 20M
    314080
    wc -l < 20M  0.02s user 0.01s system 83% cpu 0.042 total

It was around 4-5x under 6.4.1. Good work Simon!

-- Don, happily benchmarking


More information about the Libraries mailing list