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

Long ElixirLS compile time after upgrading to 0.12 #772

Closed
zwippie opened this issue Nov 11, 2022 · 8 comments
Closed

Long ElixirLS compile time after upgrading to 0.12 #772

zwippie opened this issue Nov 11, 2022 · 8 comments

Comments

@zwippie
Copy link

zwippie commented Nov 11, 2022

Environment

  • Erlang/OTP 25 [erts-13.1.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit:ns]
  • Elixir 1.14.1 (compiled with Erlang/OTP 25)
  • VSCode ElixirLS version: 0.12.1
  • Operating System Version: linux 5.15.0-52-generic

Symptoms

We have a fairly large Phoenix project with over 2000 .ex files and a lot of template files.

After upgrading the ElixirLS extension to 0.12.0, the time ElixirLS takes to compile (dyalizer disabled) our project has skyrocketed from about 2 minutes to over 50 minutes. This is observed from the Output -> ElixirLS tab in VSCode. Lots of it's taking more than 10s warnings (for almost every file in the project) and very high memory usage (over 1.5GB, observed with top).

After downgrading the ElixirLS extension to 0.11 it's down to 2 minutes again.

I've seen the same slowdown on my colleagues machines that run MacOS. I've tried to investigate what causes this but with my limited knowledge of this topic I was unable to find a smoking gun. I realize my information in this issue is very limited. Happy to provide more info if requested!

@lukaszsamson lukaszsamson transferred this issue from elixir-lsp/vscode-elixir-ls Nov 16, 2022
@VictorGaiva
Copy link

It seems that the compilation is not using more than one core at a time. This is causing the compilation to take a long time, and making any changes causes it to restart. So it ends up being compiling most of the time, and almost never works if I'm in a development and making a lot of changes.

@lud
Copy link

lud commented Nov 23, 2022

I'm in the same situation. What took 1~2 minutes takes now over 15. I don't know if that can help, but those long modules are reading from the filesystem to generate a lot of functions using macros.

@shutangyu
Copy link

shutangyu commented Nov 25, 2022

It seems recovered after the tracer disabled, i.e. delete this line :

which introduced in #724

@lukaszsamson
Copy link
Collaborator

It seems recovered after the tracer disabled, i.e. delete this line :

which introduced in #724

That was the most probable culprit. I wonder what exactly makes the compilation single threaded. Most operations there are through concurrent ets. Only project dir is taken synchronously via genserver call but the result is cached in process dict. Maybe the cache hit ratio is low. Unfortunately I don’t have any easy way of testing that. My biggest codebases are not affected by this issue.

@shutangyu
Copy link

files that triggered "it's taking more than 10s" warning are macro heavy files e.g. absinthe's graphql schema definition, phoenix's router

@lukaszsamson
Copy link
Collaborator

thanks @shutangyu I can confirm that absinthe schemas are affected. Now I can profile it.

Maybe the cache hit ratio is low

That's not it, hit ratio is high

@shutangyu
Copy link

I confirmed that 02d3b2e fixed this issue in my project, thanks @lukaszsamson 👍

@APB9785
Copy link

APB9785 commented Jan 4, 2023

@lukaszsamson I'm still experiencing this issue with the current version. On a large, macro-intensive project, I get extremely long compilation times every time I switch from one branch to another. The whole time I'm maxing out all CPU cores, and I think it will create an overheating problem if I continue.

I'm on an intel macbook running OSX 12.6
versions of VSCode, ElixirLS, elixir, and erlang, are all current

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants