You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As I brought up during the meeting today, I found a couple of situations where the OCaml code we generate results in worse performance than what we would get by implementing it directly in OCaml.
Pattern lowering binds the target of a TmMatch in a let and later matches on the bound variable. When we have a simple comparison of integers, the generated binary code makes two comparisons (first evaluating the boolean and then checking whether it is true). In https://godbolt.org/z/s3fGYa8sP, the top version is what MExpr would generate, while the bottom is a direct implementation in OCaml, which leads to more efficient x86 code. EDIT: Note that the performance issue is eliminated when using the OCaml 5.0.0 compiler with flambda enabled.
The generated OCaml code does not inline records in constructors. This leads to slightly worse performance compared to when it is inlined, as seen in https://godbolt.org/z/o8ffcbf5G.
The text was updated successfully, but these errors were encountered:
As I brought up during the meeting today, I found a couple of situations where the OCaml code we generate results in worse performance than what we would get by implementing it directly in OCaml.
target
of aTmMatch
in a let and later matches on the bound variable. When we have a simple comparison of integers, the generated binary code makes two comparisons (first evaluating the boolean and then checking whether it is true). In https://godbolt.org/z/s3fGYa8sP, the top version is what MExpr would generate, while the bottom is a direct implementation in OCaml, which leads to more efficient x86 code. EDIT: Note that the performance issue is eliminated when using the OCaml 5.0.0 compiler with flambda enabled.The text was updated successfully, but these errors were encountered: