mszmurlo

mszmurlo

Suddenly the compiler takes hours to compile code that used to get compiled in seconds

I’m working on a small library that, when use-ed in a client project, reads some external files and compiles those files into Elixir functions. The library has a __using__ macro which does the compilation of the external files during the compilation of the client project. My workflow is to work on the files of the library (there is mainly one file) and I do the compilation and tests in the client project that use-ses the library.

Today, I was working on small refactoring of the code and cleanups (in the library directory). I don’t know what I have done, but suddenly, the compilation of the client application started to take what seemed tens of minutes rather than few seconds; the direct compilation of the library is as fast as before. Yet, the client code is generated and works properly!

I make several tests:

  1. I commented out all modifications I had done. Same result
  2. I got back to the main branch of the library. Same result
  3. I cleaned every thing, including the deps, on library side and on client app side and reloaded the deps. Same result except that compilation of the external dependencies also took what seemed hours (I actually stopped it)!
  4. I copied (with cp -R) the client application into a new directory. Same result
  5. As I was getting a bit desperate, I created a new client project from scratch, copied what I needed from the old one and … it worked!

Yet I’m quite concerned as I still don’t understand what has happened. I tried to see what compiler options would emit information about where the compiler was stuck but found none.

Does anyone have a slightest idea of what could have happen and how to investigate such a problem?

Most Liked

josevalim

josevalim

Creator of Elixir

You can run mix compile --profile time in both and see where the differences are. You may also set MIX_DEBUG=1 to time the Mix tasks.

Where Next?

Popular in Questions Top

pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
sergio_101
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
Jim
As a follow up to my earlier question: I have the code compiling and running but not getting a successful login from the rest server. ...
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lis...
New
Phillipp
Hey, I have a NanoPi-M3 and try to install Elixir on their Ubuntu image. I followed the Raspberry Pi installation instructions from the ...
New
chewm
Hi guys, nice to meet you to the whole forum, I’m new here, I’m trying to configure visual studio code for elixir, right now the intellis...
New
sabri
Can someone explain the settings of pool_size of Ecto in config file? and what is the recommend size? Thanks
New
skosch
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 Top

sergio
I couldn’t find any guides that worked well with Phoenix 1.6.0 and esbuild. I hope this helps people test the waters and eases you into t...
New
_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
fireproofsocks
I’m working on defining a simple Ecto schema for a table (in PostGres), but I don’t see where I can define a column as NOT NULL. Conside...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
johnnyicon
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
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers' Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
Nvim
Elixir appears to be a superior language to Python. I don’t see any advantage of Python over Elixir. Are there any?
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New

We're in Beta

About us Mission Statement