marcandre
Elixir 1.19 compilation performance - have you noticed a difference?
Compilation time for our project degraded from ~26 seconds to ~32 seconds (~23% slower)
.
Did anyone else compare compilation performance on their project?
$ time mix compile --force && elixir -v
Compiling 1397 files (.ex)
Generating Enaia.Cldr for 2 locales named [:en, :und] with a default locale named :en
Generated enaia app
real 0m25.922s
user 1m59.042s
sys 0m16.722s
Erlang/OTP 27 [erts-15.2.7.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit]
Elixir 1.18.4 (compiled with Erlang/OTP 27)
time mix compile --force && elixir -v
Compiling 1397 files (.ex)
Generating Enaia.Cldr for 2 locales named [:en, :und] with a default locale named :en
Generated enaia app
real 0m32.299s
user 2m48.014s
sys 0m20.359s
Erlang/OTP 28 [erts-16.1.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit]
Elixir 1.19.1 (compiled with Erlang/OTP 28)
Most Liked
josevalim
This has been fixed here and backported to v1.19: Optimize protocol consolidation · elixir-lang/elixir@995f7fc · GitHub
Since it changes how protocol consolidation works, I want to give it a try locally for a few days, and we can probably ship a new version on the new year.
vanderhoop
marcandre
Thanks @josevalim!
Findings:
- 1.19 slowdown confirmed to be in “after compile callback”.
- 1.20 introduces additional slowdown in “group pass check” (1.4 → 6.4 seconds)
- OTP version not relevant.
Details:
I re-ran it in 1.18 just to confirm that the protocol consolidation / file writing was faster in 1.18:
[profile] Finished compilation cycle of 1648 modules in 20759ms
# About 3 seconds in 1.18, which matches the overall time
[profile] Finished group pass check of 1648 modules in 1069ms
<- Ran mix compile.elixir in 23795ms
I can also confirm that OTP has no impact (i.e. 1.19 with older OTP version is also slow)
Compiling with the latest changes gives the following output:
[profile] Finished cycle resolution in 0ms
[profile] Finished compilation cycle of 1648 modules in 21185ms
[profile] Finished writing modules to disk in 284ms
[profile] Finished after compile callback in 8216ms
[profile] Finished group pass check of 1648 modules in 6402ms
<- Ran mix compile.elixir in 36360ms
So “after compile callback” is indeed slow, but strangely “group pass check” is also slower in 1.20.
So I started from 1.19.1’s source and just added the “after compile callback” output and got back the quicker “group pass check”:
[profile] Finished cycle resolution in 0ms
[profile] Finished compilation cycle of 1648 modules in 21974ms
[profile] Finished after compile callback in 9124ms
[profile] Finished group pass check of 1648 modules in 1398ms
<- Ran mix compile.elixir in 34360ms
Popular in Discussions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #hex









