Python speed test

I usually just import time and do something like this:

Though there are more advanced standard Python profiling modules as well.

Edit: Here’s a quick implementation (I usually import the Timer from this module):

201112_GHPythonTimer_00.gh (2.0 KB)

Edit 2: There’s also the .NET Stopwatch class (known from C#/VB):

from System.Diagnostics import Stopwatch

sw = Stopwatch()
sw.Start()

foo = 0
for i in range(100000):
    foo+=1

sw.Stop()
print sw.Elapsed
2 Likes