thbar
October 16, 2023, 11:06am
1
Hello!
When I modify a Phoenix controller, in a given app this gives me:
==> transport
Compiling 14 files (.ex)
I would like to better understand why so many files are recompiled (maybe the app needs some rework to reduce that).
What is the best tool to trace that down?
Thanks!
– Thibaut
3 Likes
Hi! This post should provide some good pointers on how to achieve this using mix xref graph :
5 Likes
Salut @thbar
It rings a bell, check this old post:
I finally solved my problem
Touching a view now recompiles only 1 file, and touching a controller recompiles 2 files (the controller and the endpoint) instead of 208 … (went from 30sec to 2sec)
What did I do?
watched this video twice
ran a gazillion times mix xref graph --source lib/../my_controller.ex and xref graph --sink lib/../router.ex
also ran fswatch _build -r | cat | grep .beam to actually see what files are being recompiled
aliased RouteHelpers instead of im…
3 Likes
thbar
October 16, 2023, 12:13pm
4
Thanks @sabiwara & @cblavier ! I will dive into this & report back
3 Likes
To know which files are recompiled, mix compile --verbose
will list the file names.
To understand why, the the posts above help, but they predate mix xref trace
as well as mix xref graph --label compile-connected
.
I’d love to blog more about this.
5 Likes
thbar
October 22, 2023, 7:59pm
6
marcandre:
To know which files are recompiled, mix compile --verbose
will list the file names.
To understand why, the the posts above help, but they predate mix xref trace
as well as mix xref graph --label compile-connected
.
Thanks for those good tips Marc-André!
I now have a good idea of which files are recompiled, but even with compile-connected
it’s so far not very clear why these files are related. I will have to understand that a bit further.
(but thanks for your help which moved me a bit further in the right direction).