Unnecessary if condition in renderer.js for fps calculation

Issue #4 new
David Hayes created an issue

This one is incredibly trivial, but if you pre-initialized Renderer.previousFPS to the same value you initialize all the frames to be in the FPS calculation, i.e. 20, then in the following if statement, you wouldn’t need to have the extra if condition:

if ( ( this.amos.fpsPosition % 10 ) == 0 || !this.previousFps )

i.e. the || !this.previousFps

You know that for the first 10 frames, this will display 20 anyway, or a number near 20, as the average will still be dragged down by the other 40 array values containing 20. Once the first time this has been calculated, this other condition is never going to evaluate to true, but is checked on 9 out of 10 frames.

Comments (0)

  1. Log in to comment