[Haskell] ANNOUNCE: fps -- fast packed strings

Donald Bruce Stewart dons at cse.unsw.edu.au
Thu Aug 25 00:10:44 EDT 2005


Hey.

I've cabalised the FastPackedString module from darcs, used in h4sh, as the
`fps' library.

fps provides mmapped and malloc'd packed strings (byte arrays held by a
ForeignPtr), along with a list interface to these strings. It lets you do
extremely fast IO in Haskell. For example, the shell identity function written
in Haskell (i):

    $ time cat 200M > /dev/null
    0.00s user 0.19s system 2% cpu 6.481 total
    $ time i 200M > /dev/null
    0.00s user 0.00s system 0% cpu 0.172 total

    $ time cat 200M > /tmp/f   
    0.00s user 0.38s system 1% cpu 27.932 total
    $ time i 200M > /tmp/f
    0.00s user 0.48s system 7% cpu 6.454 total    

The FastPackedString module was originally written by Bryan O'Sullivan, it was
rewritten to use UArray by Simon Marlow, then rewritten and extended to support
slices, mmapping, ForeignPtrs and lots of other stuff by David Roundy and the
darcs team. This version fixes a couple of bugs related to conformance
to List, adds a testsuite, and makes the code conveniently available as
a cabalised library.

Get it:
                   http://www.cse.unsw.edu.au/~dons/fps.html
              darcs get http://www.cse.unsw.edu.au/~dons/code/fps
    
-- Don Stewart


More information about the Haskell mailing list