I've seen a lot of blogs where authors discuss throwing together quick benchmark tests, like this Ruby 1.9.0 v Python 2.5.1 that Antonio Cangiano "throws together at 3am."
Is there a simple way to time a script to the millisecond like that that I'm unaware of? Is he probably using built-in functions of OS X or individual libraries? Does Python have a standard lib for this?
How would you do this if you were just going to take the path of least resistance and throw it together at 3am?
Take a look at the timeit module.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With