Elixir
Elixir Core Team
Overall, the compiler finds more bugs, for free, and it has never been faster:
-
Infers types across clauses, finding more bugs and dead code
-
Compiles ~10% faster and has a new interpreted mode (up to 5x faster, scales to the number of cores). For more information, follow the benchmarks
-
Modifying a struct definition recompiles fewer files (it no longer requires files that only pattern match or update structs to recompile)
1. Enhancements
Elixir
- [Code] Add
module_definition: :interpretedoption toCodewhich allows module definitions to be evaluated instead of compiled. In some applications/architectures, this can lead to drastic improvements to compilation times. Note this does not affect the generated.beamfile, which will have the same performance/behaviour as before - [Code] Make module purging opt-in and move temporary module deletion to the background to speed up compilation times
- [Integer] Add
Integer.popcount/1 - [Kernel] Move struct validation in patterns and updates to type checker, this means adding and remove struct fields will cause fewer files to be recompiled
- [Kernel] Add type inference across clauses. For example, if one clause says
x when is_integer(x), then the next clause may no longer be an integer - [Kernel] Detect and warn on redundant clauses
- [List] Add
List.first!/1andList.last!/1 - Add Software Bill of Materials guide to the Documentation
Mix
- [mix compile] Add
module_definition: :interpretedoption toCodewhich allows module definitions to be evaluated instead of compiled. In some applications/architectures, this can lead to drastic improvements to compilation times. Note this does not affect the generated.beamfile, which will have the same performance/behaviour as before - [mix deps] Parallelize dep lock status checks during
deps.loadpaths, improving boot times in projects with many git dependencies
2. Potential breaking changes
Elixir
map.foo()(accessing a map field with parens) andmod.foo(invoking a function without parens) will now raise instead of emitting runtime warnings, aligning themselves with the type system behaviour
3. Bug fixes
IEx
- [IEx] Ensure warnings emitted during IEx parsing are properly displayed/printed
- [IEx] Ensure pry works across remote nodes
Mix
- [mix compile.erlang] Topsort Erlang modules before compilation for proper dependency resolution
Trending in News
Other Trending Topics
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
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
- #blog-post
- #phoenix_html
- #iex
- #graphql
- #ai
- #genstage
- #elixirconf-us
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex











Showing Posts 1 to 10- Show Best Posts
- Show All Posts (oldest first)
- Show All Posts (newest first)
josevalim
As with previous RCs, give it a try and let us know about compilation times and any false or unclear warnings!
stefanluptak
Files: 2994, Lines: 412276, Code: 349918, Comments: 6592
CPU: Apple M1 Max (10-cores), 32GB RAM
MIX_OS_DEPS_COMPILE_PARTITION_COUNTnot setElixir 1.20.0-rc.2-otp-28
mix deps.compile 312.59s user 60.35s system 226% cpu 2:44.85 totalmix compile --force 120.38s user 22.69s system 429% cpu 33.347 totalElixir 1.19.5-otp-28
mix deps.compile 286.97s user 57.77s system 241% cpu 2:22.93 totalmix compile --force 114.93s user 21.28s system 414% cpu 32.892 totaljswanner
All run with Erlang 28.4, using
time mix compile --force --profile time1.19.5-otp-28
1.20.0-rc.0
Application does not compile
1.20.0-rc.1-otp-28
1.20.0-rc.2-otp-28
neilberkman
@josevalim Type checker crash: FunctionClauseError in Module.Types.Pattern.badpattern/2 (rc.2) · Issue #15131 · elixir-lang/elixir · GitHub
sergio
Already running it on prod, my claude.md file in my monorepo has guardrails for tests and now for compile type errors. Thank you!
arctarus
Hey! I ran into a compilation issue with open_api_spex on rc.2 that doesn’t happen on rc.1.
On rc.1 the whole thing compiles fine in ~29s. On rc.2 (and current
mainat6fd161d) it just hangs forever on two modules:cast.exanddeprecated_cast.ex. I waited 5+ minutes before giving up and killing it. The compiler prints the “it’s taking more than 10s” message for both and never moves past them.Both modules have a ton of function clauses (~20+) doing pattern matching on nested structs and maps with overlapping shapes, stuff like:
My guess is the type checker is getting tripped up by all these overlapping map/struct patterns and blowing up in time.
Awlexus
Phew, there was an extreme regression in compiler performance, for the project I used to evaluate the last RC
I used
time mix compile --force --profile timeto get an idea for what is the cause. One file containing ~35 objects and input opjects for a graphql api jumped from ~220ms to 74s. The file doesn’t contain any macros that would explain the massive increase in compile time. Is there anything I can do get get a better idea on what is causing this?I didn’t check the out the warnings yet, because I think this is a more glaring issue
Edit: Sorry, this was not supposed to be a reply
josevalim
Yes, some of the new checks are expensive and we got bug reports, we are looking into optimized them right now.
josevalim
We have released v1.20.0-rc.3 with many performance improvements around the type system. See the CHANGELOG below.
For those using Absinthe, I have created this pull request which I recommend using until v1.9.1 is out: perf: Break function dispatch into groups by josevalim · Pull Request #1414 · absinthe-graphql/absinthe · GitHub
1. Enhancements
IEx
2. Bug fixes
Elixir
Enum.slice/2for ranges with step > 1 sliced by step > 1File.cp_r/3File.cp_r/3infinite loop with symlink cyclesFile.cp_r/3infinite loop when copying into subdirectory of source@type record(), fixes CI on Erlang/OTP 29File.StreamEnumerable.countfor files without trailing newlineFloat.parse/1inconsistent error handling for non-scientific notation overflowKernel.in/2in defguard (regression)stefanluptak
Apple M1 Max (10-cores),
MIX_OS_DEPS_COMPILE_PARTITION_COUNTnot setElixir 1.19.5-otp-28 + Erlang 28.4
mix deps.compile --force 284.31s user 54.21s system 231% cpu 2:25.97 totalmix compile --force 114.06s user 20.10s system 416% cpu 32.182 totalElixir 1.20.0-rc.3-otp-28 + Erlang 28.4
mix deps.compile --force 235.06s user 39.24s system 202% cpu 2:15.61 totalmix compile --force 87.31s user 15.89s system 377% cpu 27.335 total