New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Top level functions slower than module functions in Elixir <1.16 #406
Comments
@sabiwara 馃槺 Hey, thanks for the report! Do you know how far back this issue goes? It was fixed in 1.16.0-rc.1 but since when did it exist? We had been discussing recommending people to only use it from modules. Also, I'd guess the issue only appears in "full" top level mode. i.e. if you put all of |
|
This has been introduced with this commit and has been there since 1.14 as far as I can tell.
That is correct, I just confirmed it in practice.
I agree 馃憤 Maybe we could announce it on the elixir forum in the specific context of Benchee as well. |
Alright, I also went ahead copied your benchmark and ran it on the different versions: https://github.com/PragTob/elixir_playground/blob/main/bench/top_level_functions.exs I'll PR the changelog (if you haven't already) to check my understanding. Already reached out to an elixiforum mod about how to best post about it. Will probably also find some section in the README for it and mention it in the changelog for a version I'll hopefully release some time this week but I've been too optimistic in the past 馃槀 |
I haven't yet, please go ahead 馃檪 |
PR filed 鈽濓笍 |
#407 filed, I'll still fix up a bit and after it's merged probably put the same content with a bit more color into a blog post to PSA folks |
Hello,
Thanks a lot for this amazing project, I have been using it intensively 馃挏
Reporting this mostly for the record, since it was actually an Elixir issue but has been fixed in elixir 1.16.0-rc.1.
But maybe it can be documented to increase its visibility?
You can see a reproduction here, confirming both the issue (top level function 1.5x slower than module function on 1.15) and the fix (same speed on latest rc).
The discrepancy was due to disabled compiler optimizations (
no_bool_opt
,no_ssa_opt
), which were meant to speed up the execution of meta-programming but are actually only needed for the module body.The text was updated successfully, but these errors were encountered: