ocaml-flambda / flambda-backend

The Flambda backend project for OCaml
93 stars 67 forks source link

Better scoping for `[@@@ocaml.flambda_o3]` #2665

Open stedolan opened 1 month ago

stedolan commented 1 month ago

Currently, [@@@ocaml.flambda_o3] appears to be a global setting. It would be nice if this could be done on a per-function or per-submodule basis (e.g. more like how [@inline always] works)

lthls commented 1 month ago

This doesn't seem practical at the moment, as Flambda is not designed to run on functions independently. If this is just a matter of tweaking parameters (-O2 vs -O3) it could be considered, but switching between classic mode and regular flambda mode is not possible at this level. I imagine the use case is huge files (so not practical to compile with -O3) where a few functions are performance critical, is that also what you had in mind ?