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

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).
> 
> Basically I need to cache a function that maps a list
> of ordered integers into a value (float, integer). I
> would like something that allows setting a maximum size
> of the map and automatically discards the data.

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 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

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



Martin

-- 
http://mjambon.com/


  reply	other threads:[~2009-09-22 11:33 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 ` Martin Jambon [this message]
2009-09-23  7:54   ` [Caml-list] " Hugo Ferreira
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=4AB8B44F.6040503@ens-lyon.org \
    --to=martin.jambon@ens-lyon.org \
    --cc=caml-list@inria.fr \
    --cc=hmf@inescporto.pt \
    /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).