Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Jon Harrop <jon@ffconsultancy.com>
To: caml-list <caml-list@yquem.inria.fr>
Subject: Prevalence of duplicate references in the heap
Date: Sun, 3 Jan 2010 00:31:18 +0000	[thread overview]
Message-ID: <201001030031.18944.jon@ffconsultancy.com> (raw)


I took an odd design decision with HLVM and made references a struct of 
run-time type, metadata (e.g. array length), pointer to mark state and 
pointer to data. So every reference consumes 4x32=128 bits rather than the 
usual 32 bits but heap-allocated values no longer require a header.

My performance results really surprised me. For example, the "gc" benchmark in 
the HLVM test suite fills a hash table that is represented by an array spine 
containing references to array buckets. Despite having (fat) references 
everywhere, HLVM is 2.2x faster than OCaml on x86.

The main disadvantage of HLVM's approach is probably that every duplicate 
reference now duplicates the header information, wasting 96 bits. However, I 
do not believe references are duplicated in the heap very often. Both trees 
and hash tables contain many references but none are duplicated.

So I'm wondering if anyone has studied the makeup of heaps in idiomatic OCaml 
code and could point me to data on the proportion of the heap typically 
consumed by duplicate references, i.e. how much space is HLVM likely to 
waste?

Many thanks,
-- 
Dr Jon Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/?e


                 reply	other threads:[~2010-01-02 23:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=201001030031.18944.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