Rendering happens frequently. This function is invoked by the browser soon after an animation frame is requested. It may be called as often as 60 times per second (or more).
For this reason, it should be as efficient as possible. It should not do anything unnecessary. Anything that can be done in the initialization function should be done there.