
Writing Type-Stable Code in Julia - antimora
http://www.johnmyleswhite.com/notebook/2013/12/06/writing-type-stable-code-in-julia/
======
StefanKarpinski
Nice blog post. One thing I would add is that we _could_ optimize the
performance problem by peeling one iteration off the front of the loop,
thereby making the rest of the loop type-stable. However, this exposes another
problem with this code – the return type of the function depends on the value
of n: for n ≤ 0 it returns an Int, while for n > 0 it returns a Float64. Thus,
even though we could make _this_ code run faster, any code calling this
function would have to code with its poor type behavior in turn.

