Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Xavier Leroy <Xavier.Leroy@inria.fr>
To: ohl@crunch.ikp.physik.th-darmstadt.de (Thorsten Ohl)
Cc: caml-list@margaux.inria.fr
Subject: Re: Q: float arrays
Date: Thu, 31 Oct 1996 16:26:38 +0100 (MET)	[thread overview]
Message-ID: <199610311526.QAA20258@pauillac.inria.fr> (raw)
In-Reply-To: <9610301452.AA34276@crunch> from "Thorsten Ohl" at Oct 30, 96 03:52:28 pm


> I know that I'm asking too much, but wouldn't it be nice it the
> compiler did it for me?   In the example at hand,
> 
>   let f2 = map (function (p,p') -> (p*.p'))
> 
> the compiler could inline the multiplication automagically, iff it
> still had access to the definition of the map function.

That's right, and I still plan to put some automatic inlining in
Objective Caml at some point. However, known inlining strategies
are very conservative and err on the safe side in order to avoid code
size blowup. This means that if your "map" functional is sufficiently
big, it will not be inlined, even though this could resut in important
speedups.

I'm not trying to discourage anyone from writing polymorphic or
higher-order functions: if that makes the program clearer, do it and
the performances will be all right most of the time.

What I'm saying is that if the performances of your application depend
critically on a few functions (say, matrix operations, or a Fourier
transform), then one of the first things you should consider to
hand-optimize these functions is removing function parameters and
avoid polymorphic array accesses. This is much more important
performance-wise than, say, removing array bound checks or turning
recursive functions into loops.

- Xavier Leroy





  reply	other threads:[~1996-10-31 15:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-10-29 11:12 Jocelyn Serot
1996-10-30 13:40 ` Xavier Leroy
1996-10-30 14:08   ` Jocelyn Serot
1996-10-30 14:52   ` Thorsten Ohl
1996-10-31 15:26     ` Xavier Leroy [this message]
1996-11-05 16:56     ` Controlling inlining [was Re: Q: float arrays] rowan+

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=199610311526.QAA20258@pauillac.inria.fr \
    --to=xavier.leroy@inria.fr \
    --cc=caml-list@margaux.inria.fr \
    --cc=ohl@crunch.ikp.physik.th-darmstadt.de \
    /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