Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Damien Doligez <damien.doligez@inria.fr>
To: caml users <caml-list@inria.fr>
Subject: Re: [Caml-list] Can this be inlined?
Date: Tue, 11 Jan 2011 09:52:58 +0100	[thread overview]
Message-ID: <B9867F9B-457C-4725-AC24-8960CA1B2311@inria.fr> (raw)
In-Reply-To: <4D2B7893.5030802@mcmaster.ca>


On 2011-01-10, at 22:22, Jacques Carette wrote:

> I am experimenting with some fairly generic traversal code (over a complex AST), but am a little scared that the result will be horribly inefficient.

Note that in your code the function oapply only adds constant overhead to some
function calls (and these are probably non-trivial functions).  So in any case
the result cannot be "horribly inefficient", since it's within a small constant
factor of the fully-inlined version.

> In any case, the real goal here is to see if I can safely adopt a coding style like this, or do I need to manually do all the inlining myself?

The question is, will you butcher your code just because you are scared of
a _potential_ performance problem, or will you write the short, readable,
bug-free code first and then see if it really becomes a bottleneck?

Even if the inlining is definitely needed, I would start by writing and
debugging the generic version, and only then optimize it (by inlining
or otherwise).

-- Damien



      parent reply	other threads:[~2011-01-11  8:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-10 21:22 Jacques Carette
2011-01-10 21:31 ` Michael Ekstrand
2011-01-11  8:52 ` Damien Doligez [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=B9867F9B-457C-4725-AC24-8960CA1B2311@inria.fr \
    --to=damien.doligez@inria.fr \
    --cc=caml-list@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