From: Jon Harrop <jon@ffconsultancy.com>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Does the gc avoid collecting arrays of ints
Date: Mon, 23 Jul 2007 21:23:52 +0100 [thread overview]
Message-ID: <200707232123.52470.jon@ffconsultancy.com> (raw)
In-Reply-To: <9d3ec8300707231035i5a218c16lb1bb1c11cac23e6d@mail.gmail.com>
On Monday 23 July 2007 18:35:40 Till Varoquaux wrote:
> Looking at ocaml's source code I see that the values representing
> arrays have a tag representing the type of their content (I'm guessing
> boxed/unboxed). Does this mean that a bidimensional array containing
> ints will only be explored in one direction during garbage collection?
> If so, how do the compare to Bigarray's (I'm guessing they still are
> slower).
My gut feeling is that an array of arrays would be faster. You might also like
to abstract away a single array behind the interface of a multidimensional
array (particularly if you're on 64-bit).
However, there are some wierdnesses here. The GC treats the stack and arrays
of pointers atomically, traversing all elements in one go. So having a single
large array of boxed values (like an array of arrays or an array of lists in
a Hashtbl) can cause significant stalls in the incremental GC.
I found this performance characteristic whilst optimizing Smoke's worst case
performance, which is very important for such soft-real-time applications. I
had "optimized" by memoizing stuff and things in a hash table, which turned
out to slow the GC down enormously whenever it stumbled upon the hash table.
Incidentally, I get the distinct impression that Chistophe's question isn't
going to get answered until the ICFP is done and dusted and everyone has
recouperated. ;-)
--
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
OCaml for Scientists
http://www.ffconsultancy.com/products/ocaml_for_scientists/?e
next prev parent reply other threads:[~2007-07-23 20:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-23 17:35 Till Varoquaux
2007-07-23 20:23 ` Jon Harrop [this message]
2007-07-24 10:23 ` [Caml-list] " Till Varoquaux
2007-08-05 16:07 ` Xavier Leroy
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=200707232123.52470.jon@ffconsultancy.com \
--to=jon@ffconsultancy.com \
--cc=caml-list@yquem.inria.fr \
/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).