Improve compile times
I have noticed that my compile times are growing. For example, if I change one resource file and compile, it takes about 8 seconds for the compilation to complete.
I started out with a single Ash API, and I have now split this into two. However, compiling with the
--verbose
flag shows that all files in the the api of the modified resource are compiled (expected) however a number of resources from the other API are also recompiled. 23 files are recompiled in total.
So, is 8 seconds to recompile 23 files on an M1 Macbook pro normal? Could the fact that I have cross-api relationships be contributing to this? 8 seconds doesn't sound bad, however as the application grows it could become a barrier to doing test driven development.29 Replies
🤔 that is interesting
we take steps to prevent that kind of thing
could you perhaps show me an example of another file that is recompiled when your resource is compiled?
Or a few examples?
🤔
you can use xref to potentially find some candidate causes
mix xref graph --sink the_file_youre_compiling --label compile
and
mix xref graph --sink the_file_youre_compiling --label compile-connected
👀
Thanks, it sounds like this is unusual and it's probably something I'll have to hunt down. Here's the result of those xref commands https://gist.github.com/ahey/8761b580d8ce8a3277f6dee9c587ba02
🤔 This actually might be something we've done
I'm wondering if our ecto association addition may have caused this 😢
I can try some older version of ash to see if that resolves?
damnit
yeah its the ecto association stuff 😢
okay, can you try this branch?
no-relationships
of ash
👀
{:ash, github: "ash-project", branch: "no-relationships", override: true}
should do it
sorry
just pushed another thing to it
so if you pulled, pull againStrangely, that branch does not exist
try again?
Got it
Hmm, this branch has not changed anything. Changing that 1 file results in the same 23 files being compiled.
🤔
So it might be something i've done
I don't think so, but possibly
I just pushed another potential fix
👀
Unfortunately the issue persists
okay round 3
try again 😆
👀
Yes!! That did it
Only 3 files compiled
Okay. So now I need to figure out if what I just did is actually okay 😆
I'll run my test suite as a start
I think it should be okay
I love how fast my test suite is
wait did they just get faster 😆 or do you just mean in general
No just in general 😄
oh okay good. I was worried haha, if what I just did changed your test speed then shit definitely got weird
I'll push it to main.
But the compile step of running tests is down to 1.6 seconds from 8 seconds when I change 1 file.
Thanks for you help 🥳
np 🙂 Its pushed to main, will be in a release at some point
thanks for pointing out the issue
np