Code purity isn't just for you, it's also for the compiler to be able to make assumptions about the code in order to apply optimizations that would not otherwise be possible. For example, if the compiler "knows" that a certain branch won't be used, it doesn't have to evaluate it. This is part of the reason why Haskell can reach near-C performance and why its recursion is particularly performative.