[Haskell] ANNOUNCE: FPS - FastPackedStrings 0.2

Donald Bruce Stewart dons at cse.unsw.edu.au
Wed Apr 19 05:23:25 EDT 2006


I'm pleased to announce version 0.2 of FPS, the fast, packed string
library for Haskell. 

FPS allows you to have time and space efficient arrays of bytes accessed
via a List interface, along with fast IO on those strings. FPS is, in
particular, suited for heavy duty string and IO projects.  It is also
useful for applications that must pass strings back and forward from C.

Version 0.2 features a number of improvements over v0.1.

    * Its faster!

    * There is a richer interface.

    * More support for converting between C, Addr# and Haskell strings.
      (in particular, there are 0-copy functions to create FPS strings
      from Addr# and to create CStrings from FPS')

Get it here:

    Homepage:    http://www.cse.unsw.edu.au/~dons/fps.html
    Interface:   http://www.cse.unsw.edu.au/~dons/fps/Data.FastPackedString.html

    FTP:         ftp://ftp.cse.unsw.edu.au/pub/users/dons/fps/fps-0.2.tar.gz
    darcs:       darcs get --partial http://www.cse.unsw.edu.au/~dons/code/fps

Cheers,
  Don

------------------------------------------------------------------------

Here are benchmarking results for 20M strings, for versions 0.1 and 0.2
of FPS, compared against Simon Marlow's prototype packedstring code, the
current Data.PackedString library and traditional [Char] functions.

Functions that are only provided by FPS (such as the various CString
routines) are not tested.

Key: FPS2 = Fast Packed String v2
     FPS1 = Fast Packed String v1
     SPS  = Simon Marlow's packedstring prototype
     PS   = Data.PackedString
     [a]  = [Char]

     ~    = unchanged from FPS2
     -    = no function exists
     !    = stack or memory exhaustion

Size of test data: 21256k
Time in seconds.

                    FPS2    FPS1    SPS     PS*     [a]
    ++              0.078   ~       !       !       1.288   
    length          0.000   ~       0.000   0.000   0.131   
    pack            0.345   2.043   0.502   0.337   -       
    unpack          1.596   ~       1.630   7.445   -       
    compare         0.000   ~       0.000   0.000   0.000   
    index           0.000   ~       0.000   0.000   0.000   
    map             2.664   4.283   2.917   4.813   7.286   
    filter          0.282   0.482   2.805   0.954   0.305   
    take            0.000   ~       0.000   0.024   0.005   
    drop            0.000   ~       0.000   11.768  0.130   
    takeWhile       0.000   ~       1.498   0.000   0.000   
    dropWhile       0.000   ~       1.985   8.447   0.130   
    span            0.000   ~       9.289   11.144  0.131   
    break           0.000   ~       9.383   11.268  0.133   
    lines           0.421   ~       1.114   1.367   2.790   
    unlines         0.121   ~       !       !       10.950  
    words           2.115   3.202   2.128   5.644   4.184   
    unwords         0.058   ~       !       !       1.305   
    reverse         0.024   4.606   12.997  13.018  1.622   
    concat          0.029   ~       12.701  11.459  1.163   
    cons            0.016   3.094   2.064   8.358   0.131   
    snoc            0.017   1.536   -       -       -       
    empty           0.000   ~       0.000   0.000   0.000   
    head            0.000   ~       0.000   0.000   0.000   
    tail            0.000   ~       0.000   14.490  0.130   
    last            0.000   ~       -       -       0.143   
    init            0.000   ~       -       -       1.147   
    inits           5.350   -       -       -       !       
    tails           6.634   -       -       -       1.136   
    intersperse     0.034   4.590   -       -       10.517  
    concatMap       !       -       -       -       1.131   
    any             0.000   ~       -       -       0.000   
    all             0.000   ~       -       -       0.000   
    sort            14.380  15.773  -       -       !
    maximum         0.024   ~       -       -       0.183   
    minimum         0.025   ~       -       -       0.185   
    replicate       0.008   ~       -       -       0.053   
    elem            0.000   ~       1.490   0.001   0.000   
    find            0.278   0.366   -       -       0.000   
    elemIndex       0.000   ~       -       -       0.000   
    elemIndicies    4.192   ~       -       -       0.314   

* Note that it is not possible to directly read a string larger than 1M
into a Data.PackedString (due to a space leak). Instead you need to use
packString


More information about the Haskell mailing list