Pickling a finite map (Binary + zlib) [was: Data.Binary poor read performance]

Christian Maeder Christian.Maeder at dfki.de
Tue Feb 24 06:04:50 EST 2009

Felipe Lessa wrote:
> The builds seem fine, but we spot a (length xs) on the beginning.
> Maybe this is the culprit? We already know the size of the map (it was
> serialized), so it is just a matter of exporting
> fromDistinctAscSizedList :: Int -> [(k, a)] -> Map k a

Excellent idea, what does stop you? fromDistinctAscList is already a
function with a precondition that is not checked.

> Too bad 'Map' is exported as an abstract data type and it's not
> straighforward to test this conjecture. Any ideas?

One really doesn't want to see the actual implementation (except for
debugging or tuning purposes), but maybe conversions to and from a fully
(and uniquely) balanced binary tree are desirable.
(a basic binary tree data type is still missing on hackage).

I think, equal maps should not yield different serialization results
just because the internal tree structure happens to be different, but
that's of course debatable.

Cheers Christian

Maybe the discussion should be continued on libraries at haskell.org?

More information about the Libraries mailing list