caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Hugo Ferreira <hmf@inescporto.pt>
To: Martin Jambon <martin.jambon@ens-lyon.org>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Cache algorithms: implementation or library available?
Date: Wed, 23 Sep 2009 08:54:33 +0100	[thread overview]
Message-ID: <4AB9D439.4070304@inescporto.pt> (raw)
In-Reply-To: <4AB8B44F.6040503@ens-lyon.org>

Hi Martin,

Martin Jambon wrote:
> Hugo Ferreira wrote:
>> Hello,
>>
>> I would like to know if anyone has or knows of an Ocaml
>> library or open-source code implementation of some cache
>> algorithms (example: least recently used).
...
> 
> There are so many possible access patterns and trade-offs:
> 
> - speed requirements?
> - memory requirements?
> - constant size or just bounded?
> - is the probability of accessing an element a function of time?
> 

I cannot say. It really depends on the convergence of the
algorithm which in turn depends on the data. I don't really
have enough information at this point to choose.

> I see two frequent use cases:
> 
> a.  some elements are accessed more frequently than others regardless of time
> b.  recently-accessed elements have a higher probability of being accessed
> 

I think (b) is the more appropriate one. As the algorithm converges so
does the probability of accessing a given key rise.

> Alain Frisch provides an implementation of roughly a hash table in which
> buckets hold only one element, which looks great at least for case (a):
> 
>   http://alain.frisch.fr/soft.html#memo
> 
>

I've looked at the code ("tiny module" indeed).
May be of use to me. Don't like the use Obj.magic
and the Lazy module. Easy enough to adapt though.


Funny enough I was expecting complicated uses if the Weak module.

Thanks,
Hugo.


> 
> Martin
> 


  reply	other threads:[~2009-09-23  7:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-22 10:29 Hugo Ferreira
2009-09-22 11:26 ` [Caml-list] " Martin Jambon
2009-09-23  7:54   ` Hugo Ferreira [this message]
2009-09-23  7:58     ` Hugo Ferreira
2009-09-23 15:09     ` Damien Doligez
2009-09-23 15:19       ` David McClain
2009-09-23 16:26         ` Mattias Engdegård
2009-09-24 13:14           ` Hugo Ferreira
2009-09-23 12:54 ` Gerd Stolpmann
2009-09-23 14:11   ` Jan Kybic
2009-09-23 15:02 ` Dario Teixeira

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4AB9D439.4070304@inescporto.pt \
    --to=hmf@inescporto.pt \
    --cc=caml-list@inria.fr \
    --cc=martin.jambon@ens-lyon.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).