Recompilation speedup: don't make MediaProxy be a compile-dep of Router
Over the next few days I'll be sending over about ten (maybe twenty) granular MRs to speed up recompilation by limiting compile-time dependencies and breaking compile-time cycles.
A cycle occurs when A -> B -> C -> A
(->
means "depends on" and the letter are modules)
A compile-time cycle occurs when any module in a cycle has a compile-time dependency on another module. When this happens, changing any file in the cycle will cause the entire cycle to recompile. What's worse is that cycles can overlap, making one cycle's recompilation trigger the recompilation of a whole other cycle.
You can verify this change by running mix xref graph --format cycles --label compile
before and after this change:
https://www.diffchecker.com/2TQViXQh
This one small change is dramatic. It removes an entire compile-time cycle on its own, and it also reduces the size of 17 other cycles.
In a Router, calling scope
creates a compile-time dependency on whatever module you pass, while get
, post
, etc do not.