[Haskell-cafe] [RFC] benchmarks of bytestrings, teaser

Peter Lund firefly at vax64.dk
Sun Dec 16 00:45:21 EST 2007

On Sat, 2007-12-15 at 19:07 -0800, Don Stewart wrote:

> Well, I'm not going to wait till Wednesday for the numbers!

But I got you to write down predictions before you ran the tests, which
is precisely what I wanted :)

> Summary,
>       * Program 1 is fast, as expected, but exhbits a bug in the bytestring
>         library's lazy bytestring fusion system.  Something in length or filter
>         isn't doing the right job. This code will be replaced by the stream fusion
>         system soon.


>       * Program 2: as expected. strict IO uses O(N) space, and that has performance 
>         effects.
>       * Program 3: lazy bytestrings use constant space, but you better avoid
>         redundant bounds checks in the inner loops. 

Maybe its extra bounds-checking that makes it slow, as you say.  It
probably is.  I must admit that I couldn't follow the
core/stg/C--/assembly code at all.

>       * Program 4: strings are silly

No they are not.

They are the default data structure for text and give the baseline that
bytestrings should beat.

I find it interesting to see *if* bytestrings beat it and if so, by how
much.  The vanilla string versions of my tests all use less memory than
any of the other versions, but they are a bit slower.  And perhaps not
as much slower as they should be...

>       * Program 5: as expected. similar to program 2.
>       * Program 6: strict foldl's over lazy bytestrings are good :)
>                    fast, and constant space.
>       * Program 7: see program 4.
> Pretty much as expected then, but with a bug identified in lazy bytestring fusion (I think).
> Nice little benchmark.

Thanks :)

There are more...


More information about the Haskell-Cafe mailing list