Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: skaller <skaller@users.sourceforge.net>
To: Jacques GARRIGUE <garrigue@kurims.kyoto-u.ac.jp>
Cc: kybic@fel.cvut.cz, caml-list@pauillac.inria.fr
Subject: Re: [Caml-list] Q: automatic forgetting cache, module Weak, Gc control
Date: 01 Jul 2004 23:59:02 +1000	[thread overview]
Message-ID: <1088690342.2582.122.camel@pelican.wigram> (raw)
In-Reply-To: <20040701.174358.116814367.garrigue@kurims.kyoto-u.ac.jp>

On Thu, 2004-07-01 at 18:43, Jacques GARRIGUE wrote:
[caching results]

A more labor intensive idea would be to manage the
caches yourself. This has the advantage -- and disadvantage --
that you're totally in control.

One idea -- just use a fixed sized cyclic buffer,
keep usage stats, and manually tune the buffer sizes.

Another more flexible and potentially expensive
technique is to cache everything in a thread-safe
manner, and run a separate 'reaper' thread to purge
the most useless values. This has the advantage that
the cache control is lexically isolated and so 
can be worked on independently. Obviously needing
to use a thread-lock to put values in the cache
will cost big time. 

The big plus here is that you can
actually tune the reaping dynamically .. that is,
whilst the program is actually running.
If you really want to get fancy you could actually
make a second thread that output usage stats on 
a socket, and collect them in some kind of crude
dynamic graph you could watch, so as to understand
the loading better.

I'm NOT recommending this technique over using
Weak/GC tuning, I think you should try that first
since it integrates seamlessly with the actual
memory management system.

-- 
John Skaller, mailto:skaller@users.sf.net
voice: 061-2-9660-0850, 
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language http://felix.sf.net



-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


  reply	other threads:[~2004-07-01 13:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-30 11:05 Jan Kybic
2004-07-01  8:43 ` Jacques GARRIGUE
2004-07-01 13:59   ` skaller [this message]
2004-07-01 16:25     ` [Caml-list] " Jan Kybic
2004-07-01 18:14       ` Alex Baretta
2004-07-02  8:53       ` Hendrik Tews
2004-07-02  9:40         ` Jan Kybic

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=1088690342.2582.122.camel@pelican.wigram \
    --to=skaller@users.sourceforge.net \
    --cc=caml-list@pauillac.inria.fr \
    --cc=garrigue@kurims.kyoto-u.ac.jp \
    --cc=kybic@fel.cvut.cz \
    /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