python test program snippet run time
import timeit print timeit.timeit("x = 1")
or:
You can also test by creating a timing instance
def test(): x = 1 x += 1 t = timeit.Timer(test) print t.timeit() # default 1,000,000 times t = timeit.Timer("x = 1") print t.timeit()The above code shows that the timer class can be instantiated with characters, or it can be called with an object with the __call__ attribute, and the function is also an object with the __call__ attribute!