Ad
  • Custom User Avatar

    response to old question on performance:

    my understanding is because the divisions are all repetition and the Math.Log is all repetition.

    combined altogether, youre doing approximately more loops than what you think jt should be doing.

  • Custom User Avatar

    Seems like you are a type of guy who would calculate 9 * 9 by adding 9 nine times instead of using a multiplication table

  • Custom User Avatar

    I'm sort of a js noob, how did you compare the execution times and with what inputs? I tried using something called perflink and somehow got the exact opposite result?

  • Custom User Avatar

    A lot of people are really up their own behinds about this not being the best practice, thinking that it's because coders don't know basic math instead of the fact that the computation time on this O(n) is over twice as long as a while loop. Elitists are often not elite, and the comments on this solution are the proof.

  • Custom User Avatar

    Faster to type, but not faster to compute. It takes over twice as long for the computer to accomplish this task than a while loop. Hopefully in the past three years you've come to realize the compounding importance of this and perhaps grown some perspective on why you may not always be right, while looking down on others less.