Enable OCaml flambda by default and -O3
Context
Flambda is an OCaml optimization that improves inlining and specialization, because of this it leads to an overall performance boost. This MR enables flambda on all tezos built using the Makefile
script, so it includes the docker images.
-O3
was also enabled, this increases the performance across the board. And the warning 58
was supressed as we currently use -nostdlib
and OCaml doesn't provide a way to include only .cmx
files as mentioned in this issue on dune.
The choice of enabling it by default is to prevent that by accident some nodes are running without it enabled. This is also a concern regarding the opam package, maybe it should also enforce that flambda is enabled.
Depends on: !2381 (closed)
Benchmarks
Runtime
Benchmarks Dexter, FA1.2 and the michelson interpreter can be found below.
https://gist.github.com/EduardoRFS/64731f087dd12399ec9b0925617d3b97
Build time
The total computing power spent increased by almost 25%
when using dev mode, but this is mitigated by parallelism, on my computer the total build time increased by 6 seconds. This seems reasonable especially as developers should be mostly using dune build -w
or even dune build -w @check
, which wouldn't be affected by that.
DUNE_PROFILE=dev make 347.48s user 169.73s system 811% cpu 1:03.71 total
DUNE_PROFILE=dev make 447.37s user 185.02s system 906% cpu 1:09.72 total
Checklist
-
Document the interface of any function added or modified (see the coding guidelines) -
Provide automatic testing (see the testing guide). -
Add item in theDevelopment Version
section ofCHANGES.md
(only for new features and bug fixes).