Very long compile times on parsing_cocci/parser_cocci_menhir.ml
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?
Rich.
coccinelle 1.2 from tarball
ocaml-5.1.1-4.fc40.x86_64
ocaml-menhir-20231231-3.fc40.x86_64
Signature · 5 lines
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top
Hi Rich,
Quoted 1 line
Is this a known issue?
I can't confirm. On my laptop from 2017 (2 cores, 8 GB RAM), compiling from latest git (after 'make clean') takes 90 seconds.
OCaml: The OCaml toplevel, version 4.14.1
Menhir: menhir, version 20231231
Both from Debian Testing.
Or did I miss a step?
Happy hacking,
Wolfram
Quoted 11 lines · Richard W.M. Jones
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.
The point is that it is a parser, so the code is generated. I use OCaml 4.13.1 or 5.0, not 5.1.1. I have the same version of menhir as the one you mention.
I can try to make it smaller.
julia
Quoted 15 lines
Rich.
coccinelle 1.2 from tarball
ocaml-5.1.1-4.fc40.x86_64
ocaml-menhir-20231231-3.fc40.x86_64--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top
Re: [cocci] Checking compilation durations for “parser_cocci_menhir.ml”
In reply to Richard W.M. JonesQuoted 2 lines
This single file takes a very long time to compile, about 34 minutes on my 2 year old Intel laptop.
I find such an experience report surprising.
How do you think about to improve software profiling accordingly?
Quoted 3 lines
It's quite large too ...
139201 ./coccinelle-1.2/parsing_cocci/parser_cocci_menhir.ml
How will the software evolve further here?
Quoted 2 lines
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.
Did you notice any differences between compiler versions?
Regards,
Markus
Quoted 8 lines · Wolfram Sang
Hi Rich,
Quoted 1 line
Is this a known issue?
I can't confirm. On my laptop from 2017 (2 cores, 8 GB RAM), compiling from latest git (after 'make clean') takes 90 seconds.
OCaml: The OCaml toplevel, version 4.14.1
I think there is some significant difference between OCaml 4.x and OCaml 5.1.1. Can you see if updating to OCaml 5.1.1 makes it slower?
Rich.
Quoted 10 lines
Menhir: menhir, version 20231231
Both from Debian Testing.
Or did I miss a step?
Happy hacking,
Wolfram
Signature · 5 lines
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v
Quoted 9 lines · Julia Lawall
Quoted 5 lines · Richard W.M. Jones
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 ...
Quoted 8 lines
Quoted 6 lines
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.
Rich.
Quoted 23 lines
The point is that it is a parser, so the code is generated. I use OCaml 4.13.1 or 5.0, not 5.1.1. I have the same version of menhir as the one you mention.
I can try to make it smaller.
julia
Quoted 15 lines
Rich.
coccinelle 1.2 from tarball
ocaml-5.1.1-4.fc40.x86_64
ocaml-menhir-20231231-3.fc40.x86_64--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top
Signature · 5 lines
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top
Quoted 17 lines · Richard W.M. Jones
Quoted 16 lines · Julia Lawall
Quoted 11 lines · Richard W.M. Jones
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?
Quoted 8 lines
Quoted 1 line
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
julia
Quoted 35 lines
Rich.
Quoted 4 lines
The point is that it is a parser, so the code is generated. I use OCaml 4.13.1 or 5.0, not 5.1.1. I have the same version of menhir as the one you mention.
Quoted 19 lines
I can try to make it smaller.
julia
Quoted 15 lines
Rich.
coccinelle 1.2 from tarball
ocaml-5.1.1-4.fc40.x86_64
ocaml-menhir-20231231-3.fc40.x86_64--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top
Quoted 27 lines · Julia Lawall
Quoted 23 lines · Richard W.M. Jones
Quoted 9 lines · Julia Lawall
Quoted 5 lines · Richard W.M. Jones
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 ...
Quoted 8 lines
Quoted 6 lines
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
Quoted 5 lines
Quoted 2 lines
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.
Rich.
Quoted 37 lines
julia
Quoted 35 lines
Rich.
Quoted 4 lines
The point is that it is a parser, so the code is generated. I use OCaml 4.13.1 or 5.0, not 5.1.1. I have the same version of menhir as the one you mention.
Quoted 19 lines
I can try to make it smaller.
julia
Quoted 15 lines
Rich.
coccinelle 1.2 from tarball
ocaml-5.1.1-4.fc40.x86_64
ocaml-menhir-20231231-3.fc40.x86_64--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top
Signature · 4 lines
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-builder quickly builds VMs from scratch http://libguestfs.org/virt-builder.1.html
Quoted 28 lines · Richard W.M. Jones
Quoted 27 lines · Julia Lawall
Quoted 23 lines · Richard W.M. Jones
Quoted 9 lines · Julia Lawall
Quoted 5 lines · Richard W.M. Jones
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 ...
Quoted 8 lines
Quoted 6 lines
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
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
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
julia
Quoted 48 lines
Rich.
Quoted 37 lines
julia
Quoted 35 lines
Rich.
Quoted 4 lines
The point is that it is a parser, so the code is generated. I use OCaml 4.13.1 or 5.0, not 5.1.1. I have the same version of menhir as the one you mention.
Quoted 19 lines
I can try to make it smaller.
julia
Quoted 15 lines
Rich.
coccinelle 1.2 from tarball
ocaml-5.1.1-4.fc40.x86_64
ocaml-menhir-20231231-3.fc40.x86_64--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html
FWIW this is the flamegraph. It's not very informative, but maybe means a bit more to people familiar with the internals of the OCaml compiler.
http://oirase.annexia.org/2024-05-ocamlopt.svg
Rich.
Signature · 5 lines
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v
Quoted 1 line · Richard W.M. Jones
FWIW this is the flamegraph. It's not very informative, but maybe
... except that 86% of the entire time is taken in these two functions (and stuff called from there):
whatever that means.
Quoted 4 lines
means a bit more to people familiar with the internals of the OCaml compiler.
Rich.
Signature · 5 lines
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 100 libraries supported. http://fedoraproject.org/wiki/MinGW
Quoted 3 lines
I think there is some significant difference between OCaml 4.x and OCaml 5.1.1. Can you see if updating to OCaml 5.1.1 makes it slower?
Sorry, there is no OCaml 5 for Debian yet and compiling the toolchain itself is beyond my bandwidth currently.
Quoted 9 lines · Richard W.M. Jones
Quoted 1 line · Richard W.M. Jones
FWIW this is the flamegraph. It's not very informative, but maybe
... except that 86% of the entire time is taken in these two functions (and stuff called from there):
whatever that means.
I don't know what it means. Do you want me to contact the OCaml people? Or do you want to contact them?
I made another test on another machine and still can't reproduce the problem.
julia
Quoted 16 lines
Quoted 5 lines
means a bit more to people familiar with the internals of the OCaml compiler.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW
Quoted 12 lines · Julia Lawall
Quoted 8 lines · Richard W.M. Jones
Quoted 1 line · Richard W.M. Jones
FWIW this is the flamegraph. It's not very informative, but maybe
... except that 86% of the entire time is taken in these two functions (and stuff called from there):
Quoted 7 lines
Quoted 1 line
whatever that means.
I don't know what it means. Do you want me to contact the OCaml people? Or do you want to contact them?
I made another test on another machine and still can't reproduce the problem.
Let me keep looking for a bit and see if I can find the root cause.
Rich.
Quoted 19 lines
julia
Quoted 16 lines
Quoted 5 lines
means a bit more to people familiar with the internals of the OCaml compiler.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW
Signature · 5 lines
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v
Quoted 1 line
Let me keep looking for a bit and see if I can find the root cause.
Can the analysis become easier anyhow according to questionable software run time characteristics?
Regards,
Markus
Quoted 3 lines · Markus Elfring
Quoted 1 line
Let me keep looking for a bit and see if I can find the root cause.
Can the analysis become easier anyhow according to questionable software run time characteristics?
I don't understand what this means.
Rich.
Quoted 2 lines
Regards,
Markus
Signature · 5 lines
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v
Re: [cocci] Analysing software build processes
Quoted 3 lines
Quoted 1 line
Can the analysis become easier anyhow according to questionable software run time characteristics?
I don't understand what this means.
Do you know further profiling tools?
Example:
https://bashdb.sourceforge.net/remake/
You managed to generate a flamegraph with a special software build process. Can we benefit any more from such data representations?
Would you like to help to achieve out of source builds for affected programs?
Regards,
Markus
Re: [cocci] Analysing software build processes
Quoted 8 lines · Markus Elfring
Quoted 3 lines
Quoted 1 line
Can the analysis become easier anyhow according to questionable software run time characteristics?
I don't understand what this means.
Do you know further profiling tools?
The problem seems to be entirely inside ocamlopt.opt, so I don't understand how tracing make will help.
Quoted 2 lines
You managed to generate a flamegraph with a special software build process. Can we benefit any more from such data representations?
There's no "special software build process". The flamegraph was collected by running 'perf record -a -g' on the machine while ocamlopt.opt was compiling a single file, and converting the perf data to a flamegraph using Brendan's tools here:
https://github.com/brendangregg/FlameGraph
Rich.
Quoted 5 lines
Would you like to help to achieve out of source builds for affected programs?
Regards,
Markus
Signature · 5 lines
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v
Re: [cocci] Analysing software build processes
Quoted 4 lines
Quoted 1 line
The problem seems to be entirely inside ocamlopt.opt, so I don't understand how tracing make will help.
I assume that you can benefit another bit from the Callgrind profile format.
https://remake.readthedocs.io/en/latest/features.html#profiling
Quoted 6 lines
Quoted 2 lines
You managed to generate a flamegraph with a special software build process. Can we benefit any more from such data representations?
There's no "special software build process". The flamegraph was collected by running 'perf record -a -g' on the machine while ocamlopt.opt was compiling a single file, …
I guess that such data generation can be improved.
The compilation command (for which undesirable software run time characteristics were accidentally observed) can be determined.
Another command variant can be tested then with special parameters, can't it?
Quoted 2 lines
Quoted 2 lines
Would you like to help to achieve out of source builds for affected programs?
You might be able to compare more OCaml compiler versions.
Would you dare to fiddle with bisecting of corresponding program variations?
Regards,
Markus
Quoted 35 lines · Julia Lawall
Quoted 31 lines · Richard W.M. Jones
Quoted 30 lines · Julia Lawall
Quoted 25 lines · Richard W.M. Jones
Quoted 9 lines · Julia Lawall
Quoted 5 lines · Richard W.M. Jones
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 ...
Quoted 8 lines
Quoted 6 lines
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.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
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.
Signature · 4 lines
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
Re: [cocci] Influence of build configuration parameter “--enable-flambda” on compilation of OCaml source files
Quoted 2 lines
It turns out this happens because Fedora enables "flambda" in the OCaml compiler (ie. ./configure --enable-flambda).
How will the influence of such a build configuration parameter evolve further for the compilation of OCaml source files?
Can it trigger adjustments for OCaml software packages?
Quoted 3 lines
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".
Thanks for such background information.
Quoted 2 lines
It's not enabled by default, which probably explains why this problem is not seen on Debian.
Will any corresponding program variations become more interesting?
Quoted 3 lines
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.
Will corresponding software run time characteristics be checked and improved any more?
Quoted 2 lines
It doesn't seem to affect Coccinelle in any other way (eg. making it faster/slower at runtime) as far as I can tell.
Would anybody like to improve such comparisons in more detail?
Regards,
Markus
Quoted 56 lines · Richard W.M. Jones
Quoted 35 lines · Julia Lawall
Quoted 31 lines · Richard W.M. Jones
Quoted 30 lines · Julia Lawall
Quoted 25 lines · Richard W.M. Jones
Quoted 9 lines · Julia Lawall
Quoted 5 lines · Richard W.M. Jones
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 ...
Quoted 8 lines
Quoted 6 lines
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.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
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.
Quoted 7 lines
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.
Thanks!
I can at least add a comment to the build instructions.
I don't know if it is worth notifying the OCaml developers. Maybe they know already that this can be a problem.
julia
Quoted 10 lines
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
Quoted 2 lines
I don't know if it is worth notifying the OCaml developers. Maybe they know already that this can be a problem.
Would you find it worthwhile to achieve desired data processing optimisations also by the means of a build configuration parameter like “--enable-flambda” in a more reasonable time frame?
Are you going to experiment further with OCaml compiler variations?
Regards,
Markus
Re: [cocci] Using OCaml compiler variants?
In reply to Richard W.M. JonesQuoted 2 lines
It turns out this happens because Fedora enables "flambda" in the OCaml compiler (ie. ./configure --enable-flambda).
I find related information interesting for further clarifications.
https://src.fedoraproject.org/rpms/ocaml/blob/f40/f/ocaml.spec#_253
Quoted 2 lines
A desire was indicated to benefit from compilation optimisations also for source files of the programming language “OCaml”.
Such optimisations mean extra data processing efforts.
Quoted 2 lines
I will discuss with Fedora if we want to keep this option enabled or drop it. …
I hope that development interests will grow for corresponding case distinctions.
The following information is also provided by the referenced software documentation:
“…
(There is no support for a single compiler that can operate in both Flambda and non-Flambda modes.) Code compiled with Flambda cannot be linked into the same program as code compiled without Flambda. Attempting to do this will result in a compiler error.
…”
Software builders would occasionally like to choose between standard and optimised system configurations.
I got the impression here that only optimised builds would be directly supported for affected OCaml software packages (in Fedora) so far.
How much were compilation durations checked during the years?
Are you looking for possibilities according to better support for other software build variants?
Regards,
Markus
Quoted 2 lines · Julia Lawall
I don't know if it is worth notifying the OCaml developers. Maybe they know already that this can be a problem.
My colleague had a go at a compiler patch:
https://github.com/ocaml/ocaml/pull/13150
Rich.
Signature · 4 lines
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-builder quickly builds VMs from scratch http://libguestfs.org/virt-builder.1.html
Quoted 7 lines · Richard W.M. Jones
Quoted 2 lines · Julia Lawall
I don't know if it is worth notifying the OCaml developers. Maybe they know already that this can be a problem.
My colleague had a go at a compiler patch:
That's great. Thanks!
julia
Quoted 10 lines
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html