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

Improve performance of algorithm to determine project deps #518

Merged
merged 1 commit into from Sep 16, 2023

Conversation

dhedlund
Copy link
Contributor

@dhedlund dhedlund commented Sep 16, 2023

Introduces smarter tracking of deps as they are loaded. These changes help to avoid traversing the same dep sub-trees multiple times. For larger projects, including umbrella projects, the same dep can be traversed millions of times.

One of our larger projects is an umbrella project with 20 umbrella apps and a little over 200 deps in our mix.lock file. With Elixir 1.15, the time it takes for dialyzer to complete increased 3x due to this issue, from 15 minutes in our CI to over 45 minutes. In order to get dialyxir working on Elixir 1.15, I also had to follow the advice in #508 to add the dialyzer dep to each app in the umbrella. I'm not sure if that caused the increase in deps being returned, or if it's due to the new logic around optional apps.

The following table represents the time it takes to run the Dialyxir.Project.include_deps/0 function against that project on my local (faster than CI machine), and how many apps the function returns:

Elixir / OTP Version Branch Execution Time Num Apps Returned
elixir1.14.4-otp-25 / erlang 25.3.1 master 33.6s 16,845,380
elixir1.14.4-otp-25 / erlang 25.3.1 deps-tree-perf-improvements 0.02s 224
elixir 1.15.5-otp-26 / erlang 26.0.2 master 15m 51.8s 44,159,867
elixir 1.15.5-otp-26 / erlang 26.0.2 deps-tree-perf-improvements 0.19s 224

Introduces smarter tracking of deps as they are loaded. These changes help to
avoid traversing the same dep sub-trees multiple times. For larger projects,
including umbrella projects, the same can be traversed millions of times.
@jeremyjh jeremyjh merged commit b4167c0 into jeremyjh:master Sep 16, 2023
12 checks passed
@jeremyjh
Copy link
Owner

Thanks!

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

Successfully merging this pull request may close these issues.

None yet

2 participants