From: "Richard W.M. Jones" <rjones@redhat.com>
To: Julia Lawall <julia.lawall@inria.fr>
Cc: cocci@inria.fr
Subject: Re: [cocci] Very long compile times on parsing_cocci/parser_cocci_menhir.ml
Date: Fri, 3 May 2024 13:15:30 +0100 [thread overview]
Message-ID: <20240503121530.GV7636@redhat.com> (raw)
In-Reply-To: <eb315099-ed3a-d2fe-a353-5fd1b3edacfb@inria.fr>
On Thu, May 02, 2024 at 07:02:30PM +0200, Julia Lawall wrote:
>
>
> On Thu, 2 May 2024, Richard W.M. Jones wrote:
>
> > On Thu, May 02, 2024 at 06:39:34PM +0200, Julia Lawall wrote:
> > >
> > >
> > > On Thu, 2 May 2024, Richard W.M. Jones wrote:
> > >
> > > > On Thu, May 02, 2024 at 11:44:00AM +0200, Julia Lawall wrote:
> > > > >
> > > > >
> > > > > On Thu, 2 May 2024, Richard W.M. Jones wrote:
> > > > >
> > > > > > OCAMLOPT parsing_cocci/parser_cocci_menhir.ml
> > > > > >
> > > > > > This single file takes a very long time to compile, about 34 minutes
> > > > > > on my 2 year old Intel laptop. It's quite large too ...
> > > > > >
> > > > > > 139201 ./coccinelle-1.2/parsing_cocci/parser_cocci_menhir.ml
> > > > > >
> > > > > > I've observed in the past that the OCaml compiler doesn't handle
> > > > > > single large files well. It seems to have some O(n^k) behaviour.
> > > > > >
> > > > > > Is this a known issue?
> > > > >
> > > > > I agree that it's slow, but I haven't seen it take 34 minutes.
> > > >
> > > > I just tried it on a much faster AMD desktop machine, but essentially
> > > > the same OCaml and menhir, and it still takes a very long time to
> > > > compile this one file: 17:35 minutes
> > > >
> > > > I tried it on a (different) machine with OCaml 4.11.1 and that was
> > > > considerably faster, taking under a minute.
> > >
> > > I tried it on an Intel server and it takes a few seconds. OCaml version
> > > 5.1.1. menhir, version 20200123
> >
> > Interesting, thanks Julia. I'll poke this further to see
> > if I can find out what the causative factor is.
>
> wc -l parser_cocci_menhir.ml gives 139201 parser_cocci_menhir.ml
It turns out this happens because Fedora enables "flambda" in the
OCaml compiler (ie. ./configure --enable-flambda).
flambda is "a series of optimisation passes provided by the native
code compilers as of OCaml 4.03" which "make it easier to write
idiomatic OCaml code without incurring performance penalties". It's
not enabled by default, which probably explains why this problem is
not seen on Debian.
More here:
https://ocaml.org/manual/5.1/flambda.html
Anyway it's not a cocci problem!
I will discuss with Fedora if we want to keep this option enabled or
drop it. It's not a show-stopper that Coccinelle takes a long time to
compile, just a bit annoying. It doesn't seem to affect Coccinelle in
any other way (eg. making it faster/slower at runtime) as far as I can
tell.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
nbdkit - Flexible, fast NBD server with plugins
https://gitlab.com/nbdkit/nbdkit
next prev parent reply other threads:[~2024-05-03 12:15 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-02 8:54 [cocci] Very long compile times on parsing_cocci/parser_cocci_menhir.ml Richard W.M. Jones
2024-05-02 9:01 ` Wolfram Sang
2024-05-02 16:16 ` Richard W.M. Jones
2024-05-02 17:40 ` Wolfram Sang
2024-05-02 9:44 ` Julia Lawall
2024-05-02 16:31 ` Richard W.M. Jones
2024-05-02 16:39 ` Julia Lawall
2024-05-02 16:49 ` Richard W.M. Jones
2024-05-02 17:02 ` Julia Lawall
2024-05-03 12:15 ` Richard W.M. Jones [this message]
2024-05-03 13:15 ` [cocci] Influence of build configuration parameter “--enable-flambda” on compilation of OCaml source files Markus Elfring
2024-05-03 15:50 ` [cocci] Very long compile times on parsing_cocci/parser_cocci_menhir.ml Julia Lawall
2024-05-03 16:43 ` Markus Elfring
2024-05-07 9:45 ` Richard W.M. Jones
2024-05-07 9:56 ` Julia Lawall
2024-05-05 5:25 ` [cocci] Using OCaml compiler variants? Markus Elfring
2024-05-02 17:19 ` [cocci] Very long compile times on parsing_cocci/parser_cocci_menhir.ml Richard W.M. Jones
2024-05-02 17:31 ` Richard W.M. Jones
2024-05-02 21:41 ` Julia Lawall
2024-05-03 7:31 ` Richard W.M. Jones
2024-05-03 8:00 ` Markus Elfring
2024-05-03 10:24 ` Richard W.M. Jones
2024-05-03 10:40 ` [cocci] Analysing software build processes Markus Elfring
2024-05-03 10:59 ` Richard W.M. Jones
2024-05-03 11:15 ` Markus Elfring
2024-05-02 10:18 ` [cocci] Checking compilation durations for “parser_cocci_menhir.ml” Markus Elfring
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=20240503121530.GV7636@redhat.com \
--to=rjones@redhat.com \
--cc=cocci@inria.fr \
--cc=julia.lawall@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.