Skip to content
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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERL-1302: Many "case"s trigger slowdown on ssa_opt_dead #4443

Closed
OTP-Maintainer opened this issue Jul 1, 2020 · 2 comments
Closed

ERL-1302: Many "case"s trigger slowdown on ssa_opt_dead #4443

OTP-Maintainer opened this issue Jul 1, 2020 · 2 comments
Assignees
Labels
bug Issue is reported as a bug priority:low team:VM Assigned to OTP team VM
Milestone

Comments

@OTP-Maintainer
Copy link

Original reporter: josevalim
Affected version: OTP-22.0
Fixed in version: OTP-24.0
Component: compiler
Migrated from: https://bugs.erlang.org/browse/ERL-1302


Someone reported a scenario where compiling some code got slower from Erlang/OTP 21 to Erlang/OTP 23. I have isolated the code to the following Erlang file:

[https://gist.github.com/josevalim/2c175678a0f85568eb001dcb97024ef5]

In my machine, it is about 7x faster to compile on Erlang/OTP 21 compared to Erlang/OTP 22. It is a bit faster on Erlang/OTP 23 (and even faster in master), but it is still 4x to 5x slower than what it was before.

Using the +time flag, we can see the majority of the time is spent on "ssa_opt_dead". I am not sure if there is something that could be done to speed it up but I thought I would open up a report in case it does reveal some pathological case. Feel free to close otherwise. :)

Thank you!
@OTP-Maintainer
Copy link
Author

josevalim said:

If you want more data samples to play with, here is another gist also generated by Elixir's template engine compiled down to Erlang: [https://gist.github.com/josevalim/acac154996e1e61058f367a5b3a161aa]

This one puts more load on the live_intervals pass rather than ssa dead. I have attached some profiling results to the gist. It takes roughly 24s on my machine.

Curiously, this also triggered a slow down on Elixir passes too. In our case, we were generating really long variable chains where `var1 -> var2 -> var3 -> varN -> integer`. In our case we could fix it by pointing to the first variable, so it become `var1 -> integer`, `var2 -> var1 -> integer`, `var3 -> var1 -> integer`, etc.

@OTP-Maintainer
Copy link
Author

bjorn said:

[https://github.com/erlang/otp/pull/2894]

 

@OTP-Maintainer OTP-Maintainer added bug Issue is reported as a bug team:VM Assigned to OTP team VM priority:low labels Feb 10, 2021
@OTP-Maintainer OTP-Maintainer added this to the OTP-24.0 milestone Feb 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is reported as a bug priority:low team:VM Assigned to OTP team VM
Projects
None yet
Development

No branches or pull requests

2 participants