The first call to delay() might request a delay shorter than the time it takes to calibrate, so that's not really workable.
And what you’re saying is of course impossible.. determining if the function is called by static analysis is not possible.
If input = 1 then delay end is impossible to analyze statically.
If you meant reference to delay, that is a bit more tractable. But then when do you actually initialize, you will see that program initialization is about the only practical place to do it. Which is exactly what is done.