caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Alexey Egorov <alex.only.d@gmail.com>
To: caml users <caml-list@inria.fr>
Subject: [Caml-list] flambda optimizations depends on unrelated things
Date: Sun, 27 Aug 2017 10:23:48 +0500	[thread overview]
Message-ID: <CAJannG4cO5fLz=Vvs4J9PSw0jpuUn4u3nzvGURkMCvE=4A3jdQ@mail.gmail.com> (raw)

Hello,

I'm trying hard to make efficient pure functional streams
implementation - and while playing with flambda, I'm discovered that
optimizations is VERY fragile and sometimes depends on completely
unrelated things.

Sometimes flambda goes mad if you change filename or just add some
empty lines to your source.

Here is example, where renaming source file increases code size by a
factor of 2 because of some unfortunate inliner decisions:

$ ls
fragile.ml
$ cp fragile.ml fragile2.ml
$ md5sum *
6a13d560736c81b3e5b5dfe7f13c2f56  fragile2.ml
6a13d560736c81b3e5b5dfe7f13c2f56  fragile.ml
$ ocamlopt -version
4.05.0
$ ocamlopt -O3 fragile.ml -dflambda 2>&1 | wc -l
1774
$ ocamlopt -O3 fragile2.ml -dflambda 2>&1 | wc -l
3835

Here is the code - https://pastebin.com/Y1DDidyN

             reply	other threads:[~2017-08-27  5:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-27  5:23 Alexey Egorov [this message]
2017-08-27  8:33 ` David Allsopp
2017-08-27 13:25   ` Alexey Egorov

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='CAJannG4cO5fLz=Vvs4J9PSw0jpuUn4u3nzvGURkMCvE=4A3jdQ@mail.gmail.com' \
    --to=alex.only.d@gmail.com \
    --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).