japplegame
Is this an issue with the new type checker?
Today I encountered an issue.
After updating Elixir from version 1.17.3 to 1.18.3, the compilation time of my project increased dramatically (about 10 times longer).
After digging through the code, I managed to reproduce this issue with the following synthetic code:
# update_map_test.ex
defmodule UpdateMapTest do
def cast(value) do
result = %{
a01: nil,
a02: nil,
a03: nil,
a04: nil,
a05: nil,
a06: nil,
a07: nil,
a08: nil,
a09: nil,
a10: nil,
a11: nil,
a12: nil,
a13: nil,
a14: nil,
a15: nil,
}
result = if value[:a], do: %{result | a01: value[:a]}, else: result
result = if value[:a], do: %{result | a02: value[:a]}, else: result
result = if value[:a], do: %{result | a03: value[:a]}, else: result
result = if value[:a], do: %{result | a04: value[:a]}, else: result
result = if value[:a], do: %{result | a05: value[:a]}, else: result
result = if value[:a], do: %{result | a06: value[:a]}, else: result
result = if value[:a], do: %{result | a07: value[:a]}, else: result
result = if value[:a], do: %{result | a08: value[:a]}, else: result
result = if value[:a], do: %{result | a09: value[:a]}, else: result
result = if value[:a], do: %{result | a10: value[:a]}, else: result
result = if value[:a], do: %{result | a11: value[:a]}, else: result
result = if value[:a], do: %{result | a12: value[:a]}, else: result
result = if value[:a], do: %{result | a13: value[:a]}, else: result
result = if value[:a], do: %{result | a14: value[:a]}, else: result
result = if value[:a], do: %{result | a15: value[:a]}, else: result
{:ok, result}
end
end
$ elixir -v
Erlang/OTP 27 [erts-15.2.5] [source] [64-bit] [smp:32:12] [ds:32:12:10] [async-threads:1] [jit:ns]
Elixir 1.18.3 (compiled with Erlang/OTP 27)
$ time elixir update_map_test.ex
real 0m9,085s
user 0m10,075s
sys 0m0,694s
$ elixir -v
Erlang/OTP 27 [erts-15.2.5] [source] [64-bit] [smp:32:12] [ds:32:12:10] [async-threads:1] [jit:ns]
Elixir 1.17.3 (compiled with Erlang/OTP 27)
$ time elixir update_map_test.ex
real 0m0,342s
user 0m0,853s
sys 0m0,322s
Interestingly, when adding new fields and updates, the compilation time seems to grow exponentially.
Most Liked
japplegame
Ok.
2
Popular in Questions
How to handle excepions in elixir? Suppose i have A, B, C ,D, E modules. and each module has get() function. A.get() method will call th...
New
Okay, I'm having a heck of a time trying to figure out how to best handle the validation of belongs_to associations in Ecto. I'm sure I'...
New
I have followed this StackOverflow post to install the specific version of Erlang.
And When I am running mix ecto.setup then getting fol...
New
I have an umbrella app.
Some of the apps inside depend on other apps in the umbrella, unsurprisingly.
I'm writing a test for one of t...
New
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible.
total = 10
while total != 0
...
New
I have a User schema with a :from_id field set to type :string:
defmodule TweetBot.Repo.Migrations.CreateUsers do
use Ecto.Migration
...
New
I tried installing
elixir 1.11.2
erlang 23.3.4
via asdf in my zsh shell. Enabled the versions locally and globally.
When I list them ...
New
Hi all,
I've just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage.
I'm trying to use Postg...
New
Hi guys, i’m new in the Elixir world, and i have to say, that i love it!
i’m having some problem to understand anonymous functions with ...
New
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
Other popular topics
Okay, I'm having a heck of a time trying to figure out how to best handle the validation of belongs_to associations in Ecto. I'm sure I'...
New
Hi all,
Trying to get some more clarity over utc_datetime and naive_datetime for Ecto:
https://hexdocs.pm/ecto/Ecto.Schema.html#module-...
New
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
You’re a programmer, so you don’t need spoon feeding with the conventional drivel about “this is an integer.” No. You need to know what’s...
New
Hi folks,
Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
New
I have an umbrella app.
Some of the apps inside depend on other apps in the umbrella, unsurprisingly.
I'm writing a test for one of t...
New
Hey guys.
I'm new to elixir and im really stocked about it. But I ran into a bit of problem - I need to convert a date sting, for examp...
New
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
We’ve put together this wiki for Phoenix LiveView - please feel free to add any info you feel is worth including.
What is Phoenix LiveV...
New
Hey :wave:t3: Elixir community,
I’ve been learning Elixir, and working on some side projects. My editor of choice is VSCode, and althoug...
New








