caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Till Varoquaux" <till.varoquaux@gmail.com>
To: "Jon Harrop" <jon@ffconsultancy.com>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Does the gc avoid collecting arrays of ints
Date: Tue, 24 Jul 2007 12:23:53 +0200	[thread overview]
Message-ID: <9d3ec8300707240323u415c7ee4mec317a5cbe54e50e@mail.gmail.com> (raw)
In-Reply-To: <200707232123.52470.jon@ffconsultancy.com>

On 7/23/07, Jon Harrop <jon@ffconsultancy.com> wrote:
...
>
> 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).
>
Array of arrayrequier you two jump through two indirections (they are
like **int instead of *int), bigarrays are based on a linear backend
whatever there dimension may be. Using single dimension arrays and
building an interface over it sounds like a good solution. I don't
feel like I have the time to benchmark.
For the record: I saw a tremendous performance boost going from two
dimensional arrays of tupple of ints to tupples of bigarrays. By
profilling I can tell I was loosing most of my time collecting local
values. This was probably due to:
_Manipulating a lot of tupples, wich needed to be collected.
_Assigning local variables to rows. This was probably a bad idea to start with..

> 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 thought OCaml did not have an incremental GC, and that minor and
major collections were both atomic.
Till
-- 
http://till-varoquaux.blogspot.com/


  reply	other threads:[~2007-07-24 10:23 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 ` [Caml-list] " Jon Harrop
2007-07-24 10:23   ` Till Varoquaux [this message]
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=9d3ec8300707240323u415c7ee4mec317a5cbe54e50e@mail.gmail.com \
    --to=till.varoquaux@gmail.com \
    --cc=caml-list@yquem.inria.fr \
    --cc=jon@ffconsultancy.com \
    /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).