So today I was presented with a challenge that has multiple solutions but which is the fastest. So I set out to figure it out. The challenge was how can you compute the number of digits in an integer easily. There are 3 obvious solutions but which one is better. So I coded up a basic example of each and tested them out.

The four methods that I have tested are, using strings, log based methods, a loop and divide and a loop with multiplication instead. (See the code below) Continue reading