Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Q: automatic forgetting cache, module Weak, Gc control
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-07-01 (18:13)
From: Alex Baretta <alex@b...>
Subject: Re: [Caml-list] Re: Q: automatic forgetting cache, module Weak, Gc control
Jan Kybic wrote:

> I am also thinking about other strategies taking into account the
> sizes of the produced results. In this case the global structure would
> be an ordered set.
> The disadvantage of putting the values into two structures is the
> memory overhead. Maybe I should avoid using Weak hashtables
> alltogether and store the values in a set of normal hashtables,
> dropping some of them, if necessary... It is difficult to get the
> memory/speed tradeoff right.

You can memoize your results in a generic manner through the use of maps 
which use result hashes as keys. Two results hashing down to the same 
value will not be stored in the same map. The number of significant bits 
used by the hash function determines the size of the map.


To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: