caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: William Chesters <williamc@paneris.org>
To: <caml-list@inria.fr>
Subject: [Caml-list] Obsessed by speed
Date: Mon, 21 May 2001 21:12:43 +0200 (CEST)	[thread overview]
Message-ID: <15113.26795.857779.14693@beertje.william.bogus> (raw)
In-Reply-To: <AAEBJHFJOIPMMIILCEPBIEBBCLAA.mattias.waldau@abc.se>

Mattias Waldau writes:
 > In the FAQ, I can read an estimation on how expensive different operations
 > in ocamlopt are.
 > 
 > I have some further questions:
 > 1. If I define Array.iter + a function that uses it,
 >    will ocamlopt combine these two functions two one?
 >    (I looked in the assembler code, but it seemed as
 >     ocamlopt didn't combine them)

That's been my experience too---definitely it would be nice to have!

 > 3. Would ocamlopt benefit from a peephole optimizer of
 >    the assembler code? Or is the assembler code already
 >    optimal?

I have generally found the backend to be very good indeed at the
assembler level.  Sometimes it gets things handed down to it from the
intermediate level (e.g. less-than-100% unboxing) which it couldn't
reasonably be expected to fix.  It's so much better than backends like
JDK, ghc, ... it isn't funny.

 > 4. What is unboxed and what isn't?

Integers are always unboxed anyway (they are tagged with a low 1 and
the arithmetic done on them is warped to accomodate it!).

Floats seem to be unboxed very well within an expression.  Float loop
variables in for-loops (sadly not tail-recursive expressions) stay
unboxed and indeed in registers, _provided_ that they are stored in
monomorphic records that are known at a high level to be
float-only---so not float ref (!!!).  Define e.g. type floatref = {
it: float }, works much better.

To a reasonable extent, whole objects are "unboxed" too, i.e. tuples
and records which are simply passed to functions which immediately
deconstruct them are elided and the components become available for
storing in registers.  I don't know to what extent this happens in
other situations but it is very helpful.
-------------------
To unsubscribe, mail caml-list-request@inria.fr.  Archives: http://caml.inria.fr


  parent reply	other threads:[~2001-05-21 19:09 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-05-16 11:16 [Caml-list] ocamlopt and Windows DLL Dmitry Bely
2001-05-18 19:51 ` [Caml-list] Obsessed by speed Mattias Waldau
2001-05-21 16:44   ` Chris Hecker
2001-05-21 19:12   ` William Chesters [this message]
2001-05-27  8:47   ` Xavier Leroy
2001-05-31 15:13   ` [Caml-list] report describing optimization of numerical computing of the ocaml compiler Peter Ronnquist
2001-05-31 15:15   ` Peter Ronnquist
2001-05-31 16:12     ` Brian Rogoff
2001-06-01  2:30       ` [Caml-list] report describing optimization of numerical computingof " John Max Skaller
2001-06-01  4:10       ` [Caml-list] report describing optimization of numerical computing of " Tom _
2001-06-01  4:20         ` Niall Dalton
2001-06-01  6:33         ` [Caml-list] SISAL (Was: report describing optimization of numerical computing...) Florian Hars
2001-06-01 22:22           ` Tom _
2001-05-31 15:15   ` [Caml-list] report describing optimization of numerical computing of the ocaml compiler Peter Ronnquist
2001-05-22 17:10 ` [Caml-list] ocamlopt and Windows DLL Dmitry Bely
2001-05-28 14:53   ` Dmitry Bely
2001-05-28 15:29     ` 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=15113.26795.857779.14693@beertje.william.bogus \
    --to=williamc@paneris.org \
    --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;
as well as URLs for NNTP newsgroup(s).