Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Mark Shinwell <mshinwell@janestreet.com>
To: David Allsopp <dra-news@metastack.com>
Cc: Berke Durak <berke.durak@gmail.com>, caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] Why is some code compiled with 4.04.0 or 4.05.0 running 2.3 times slower than the same code compiled with 4.03.0?
Date: Mon, 31 Oct 2016 07:37:25 +0000	[thread overview]
Message-ID: <CAM3Ki75h=JnSKVCZimEhY4opbcL_gwUenXAww46926nZLVPwyQ@mail.gmail.com> (raw)
In-Reply-To: <E51C5B015DBD1348A1D85763337FB6D901353F7169@Remus.metastack.local>

Thanks for the report and bisection.  We're looking at this.  Please
file a Mantis report in any case.

Mark

On 30 October 2016 at 16:49, David Allsopp <dra-news@metastack.com> wrote:
> Berke Durak wrote:
>> I compiled and ran a simple matrix-multiplication-style benchmark
>> program written in imperative style with Bigarrays (see below)
>> using versions 4.01.0, 4.03.0, 4.03.0+flambda, 4.04.0+trunk+flambda
>> (with -version 4.04.0+dev9-2015-09-05), 4.04.0+beta2+flambda
>> (4.04.0+beta2) and 4.05+trunk+flambda (4.05.0+dev0-2016-08-01).
>>
>> Execution time increased by a factor of 2.3 from 4.03+flambda to
>> 4.04+trunk+flambda.  I tried a few of the newer optimization
>> switches (-rounds X, -unboxed-types, -unbox-closures, etc.) but
>> that didn't make a significant difference.
>>
>> Execution times, repeatable within ~5%:
>>
>> 4.01.0                5.45s
>> 4.03.0                4.28s
>> 4.03.0+flambda        4.44s
>> 4.04.0+trunk+flambda  10.45s
>> 4.04.0+beta2+flambda 10.72s
>> 4.05.0+trunk+flambda  10.36s
>
> Note that this is specifically an flambda problem - neither 4.04 nor trunk exhibit the slowdown with flambda disabled.
>
> I've bisected and identified commit f7dcb as the problem (it was added to trunk after 4.03 was branched). The specific issue is the change in https://github.com/ocaml/ocaml/blob/trunk/bytecomp/simplif.ml#L473 disabling conversion of refs to mutable variables when flambda is enabled. If you remove the `&& Config.flambda = false` and rebuild ocamlopt, you should find your benchmark speed restored. flambda is supposed to be performing that optimisation itself, so something is clearly (very) wrong!
>
> Could you open a Mantis PR for this, please?
>
>
> David
>
> --
> Caml-list mailing list.  Subscription management and archives:
> https://sympa.inria.fr/sympa/arc/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs

  reply	other threads:[~2016-10-31  7:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-30  6:42 Berke Durak
2016-10-30 16:49 ` David Allsopp
2016-10-31  7:37   ` Mark Shinwell [this message]
2016-10-31 23:16     ` Berke Durak

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='CAM3Ki75h=JnSKVCZimEhY4opbcL_gwUenXAww46926nZLVPwyQ@mail.gmail.com' \
    --to=mshinwell@janestreet.com \
    --cc=berke.durak@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=dra-news@metastack.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