Improving Performance at Compile Time
Learn how to overcome performance costs using simple tweaks.
The patterns we previously discussed are powerful and flexible, and they let us have fine-tuned control over testing interactions with external services. However, there’s still one principle we’re going against.We’re introducing a runtime call to decide which double to use in production code. That is, every time we call the rain?/2
function, we’ll call Application.get_env/3
(which is essentially a read from an ETS table) to get the double module we want to use.
In this case, the performance hit is negligible compared to the cost of the HTTP ...