getting a Binary module into the standard libs

Simon Marlow simonmar@microsoft.com
Mon, 11 Nov 2002 09:54:52 -0000


> > - How important is this?=20
>=20
> The motivation for my Binary library was to save space, whereas
> Simon's motivation was to be fast (at any rate to be faster than
> parsing text).  Thus, a bitstream is potentially far more compact
> than a bytestream, depending of course on the natural size of the
> objects to be serialised.  But the tradeoff is that a bytestream
> is far quicker to build/read, because there is no tricky logic
> required to ensure that bits are shifted to the right place etc.
>=20
> Different applications will require different characteristics.
> There is no one-size-fits-all.

I should add that I never actually benchmarked the speed difference
between using bits and bytes, and I don't believe it's clearly a win to
use bytes.  There's the time to get the data off the disk, caching
effects, etc. to take into account, all of which tend to be more
important the more recent your machine is.

I'd be delighted if someone would add support for bits to GHC's Binary
library (to get a fair comparison) and did some measurements.  It may be
that there's no need to add an abstraction layer to provide support for
both bits and bytes.

Cheers,
	Simon