Closed foni closed 5 years ago
WhatYou don't need the quotes while calling the magic. Try:
%timeit random_walk_fastest(n=10000)
Thanks a lot. Without the quotes, the measurements are very close.
So with quotes, %timeit was just evaluating the string literal expression "random_walk_fastest(n=10000)" instead of calling random_walk_fastest() function.
Hi, I cannot wrap my head around the big difference between the execution times when I use timeit() from tools.py versus the ipython magic function %timeit. can someone help me?
Regards, fonis.
%timeit "random_walk_fastest(n=10000)" 7.52 ns ± 0.258 ns per loop (mean ± std. dev. of 7 runs, 100000000 loops each)
timeit("random_walk_fastest(n=10000)", globals()) 1000 loops, best of 3: 99 usec per loop