This will take two lots of javascript code, and benchmark them in a for loop with variable 'i' as the index. The length of the for loop will vary from 'from' to 'to' in 'increment' lots to test the effect of repetition.

You may have 'if' statements, etc - just don't forget to put semi-colons on the end of appropriate lines. Most modern browsers will chuck a spaz on operations that take too long, so consider increasing 'increment', raising 'from' or lowering 'to'. Results are generally accurate to around 20ms, depending on platform.

Code One
Code Two
From:
To:
Increment: