[Haskell-cafe] Re: [Haskell] ANNOUNCE: binary: high performance, pure binary serialisation

Donald Bruce Stewart dons at cse.unsw.edu.au
Fri Jan 26 18:37:28 EST 2007


tomasz.zielonka:
> On Fri, Jan 26, 2007 at 02:16:22PM +1100, Donald Bruce Stewart wrote:
> > We believe so, and its a bug if this is not the case.
> > 
> > The src documents the encoding format used for each type (we were unable
> > to attach haddocks to instances.. grr.)
> > 
> > All data is encoded in Network order, and extended to 64 bits for word
> > sized values (like Int). It should be possible to encode a structure
> > with ghc on x86, and decode it on a sparc64 running hugs.
> 
> Did you consider using an encoding which uses variable number of bytes?
> If yes, I would be interested to know your reason for not choosing such
> an encoding. Efficiency?

Yes, efficiency. If you look in tests/ there's a pretty heavy duty
benchmark we use to compare against C. Sticking to word sized writes
where possible is a big one (up to 10 fold).

Interestingly, I did write an aligned-only, host-endian layer, and it
was only some 10% faster on x86 over network order code.

-- Don


More information about the Haskell-Cafe mailing list