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

Donald Bruce Stewart dons at cse.unsw.edu.au
Sat Jan 27 19:46:51 EST 2007


lemming:
> 
> On Sat, 27 Jan 2007, Donald Bruce Stewart wrote:
> 
> > lemming:
> > > 
> > > On Fri, 26 Jan 2007, Donald Bruce Stewart wrote:
> > > 
> > > > 
> > > >         Binary: high performance, pure binary serialisation for Haskell
> > > >      ---------------------------------------------------------------------- 
> > > > 
> > > > The Binary Strike Team is pleased to announce the release of a new,
> > > > pure, efficient binary serialisation library for Haskell, now available
> > > > from Hackage:
> > > >     
> > > >  tarball:    http://hackage.haskell.org/cgi-bin/hackage-scripts/package/binary/0.2
> > > >  darcs:      darcs get http://darcs.haskell.org/binary
> > > >  haddocks:   http://www.cse.unsw.edu.au/~dons/binary/Data-Binary.html
> > > 
> > > I want to write out data in the machine's endianess, because that data 
> > > will be post-processed by sox, which reads data in the machine's 
> > > endianess. Is this also planned for the package?
> > 
> > The underlying Get and Put monads support explicit endian writes and
> > reads, which you can add to your instances explicitly:
> > 
> >     http://www.cse.unsw.edu.au/~dons/binary/Data-Binary-Get.html#5
> >     http://www.cse.unsw.edu.au/~dons/binary/Data-Binary-Put.html#5
> > 
> > So you can do that now. 
> 
> Of course, I can check for the machine's endianess, then decide whether to
> use putWord16be and putWord16le. But I assume that it is more efficient,
> if there would be some function putWord16native, which writes out in the
> machine's native endianess.

Ah yes, I actually did have the putWord*native in the code at one point,
in my branch for doing aligned-only writes. The speed up wasn't
signficant so I didn't commit it, but the host-order primitives are useful, so
will appear in the next version of the library.

-- Don


More information about the Haskell-Cafe mailing list