[Haskell-cafe] Binary serialization, was Re: Abstraction leak

Bulat Ziganshin bulat.ziganshin at gmail.com
Wed Jul 4 15:49:09 EDT 2007


Hello Philip,

Wednesday, July 4, 2007, 9:41:27 PM, you wrote:

> I'm thinking of the elimination of the boxing of values drawn out of
> the input stream where possible, eg if I was writing a stream
> processor that folded across the values in the input stream, it would
> (presumably) be more efficient if the compiler noticed that the
> function in question was (say) just reading Int values at offsets
> within the stream, and could pass those as unboxed references in the
> compiled code rather than freshly constructed values.

it will depend on your code. the library doesn't make unnecessary
boxing, but (unlike Data.Binary?) it supports only monadic
(de)serialization. so there is no room for ByteString-like fusion
which pass unboxed data through several transformations. with my lib,
you can only read whole unboxed structure and then process it:

data T = C !Int32 !Word16

do x <- get h :: IO T
   processT $! x

-- 
Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com



More information about the Haskell-Cafe mailing list