caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Alain Frisch <alain@frisch.fr>
To: Leo White <lpw25@cam.ac.uk>,
	 Thomas Braibant <thomas.braibant@gmail.com>
Cc: John Whitington <john@coherentgraphics.co.uk>,
	 "caml-list@inria.fr" <caml-list@inria.fr>
Subject: [Caml-list] More efficient compilation of functors? (was: Wrapping up the Set module in another)
Date: Thu, 03 Apr 2014 22:31:42 +0200	[thread overview]
Message-ID: <533DC52E.9000707@frisch.fr> (raw)
In-Reply-To: <y2aha6axzat.fsf@kingston.cl.cam.ac.uk>

On 4/3/2014 4:28 PM, Leo White wrote:
> The main additional cost would come from calling `Set.Make` in
> `set_of_list` and creating new modules in `set_of_list` and `insert`.
> `Set.Make` has to create a lot of closures which capture the `compare`
> function. I think these closures are all allocated at once, but this
> still means a lot of assignments. Creating the new modules is a record
> allocation and assignment of all the record fields.

I'm wondering whether an alternative compilation scheme could make 
functor instantiation much faster.  Instead of having individual 
closures for all (non-closed) functions the functor exports, one could 
create a single big closure representing all functions at once.  It 
would typically contain the functor's argument itself, plus other non 
functional values computed during the functor's body initialization (or 
maybe one could even keep a reference to the block representing the 
functor's result).  The closure would be allocated at the beginning 
(with dummy values) and filled along the evaluation of the body.


-- Alain

      reply	other threads:[~2014-04-03 20:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-26 15:58 [Caml-list] Wrapping up the Set module in another John Whitington
2014-03-26 17:04 ` John Carr
2014-03-26 21:11 ` Leo White
2014-03-28  8:22   ` Thomas Braibant
2014-04-03 14:28     ` Leo White
2014-04-03 20:31       ` Alain Frisch [this message]

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=533DC52E.9000707@frisch.fr \
    --to=alain@frisch.fr \
    --cc=caml-list@inria.fr \
    --cc=john@coherentgraphics.co.uk \
    --cc=lpw25@cam.ac.uk \
    --cc=thomas.braibant@gmail.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).