[Haskell-cafe] Re: bizarre memory usage with data.binary

Thomas Conway drtomc at gmail.com
Thu Oct 4 04:57:58 EDT 2007


On 10/4/07, Jules Bean <jules at jellybean.co.uk> wrote:
> ...and indeed it can't be done, except by the naive brute-force method
> of comparing every subtree, possibly optimised by cryptographically
> hashing a representation of every subtree, since sharing isn't an
> observable property.

At least one Prolog implementation (I forget which, I'm sorry), had a
[de]serialisation library which used a hash-consing approach.
Basically, it did its serialization using a post-order traversal and
emitted references to previous values when the same value had already
been emitted. Not rocket science. Actually, I've heard a Prolog guy -
Bart Demoen - talk about doing pretty much this during GC to improve
sharing.

cheers,
T.
 --
Thomas Conway
drtomc at gmail.com

Silence is the perfectest herald of joy:
I were but little happy, if I could say how much.


More information about the Haskell-Cafe mailing list