fork download
  1. import timeit
  2.  
  3. def f(x): return x + 2
  4. g = lambda x: x + 2
  5.  
  6. print(timeit.timeit('f(3)', globals=globals()))
  7. print(timeit.timeit('g(3)', globals=globals()))
Success #stdin #stdout 0.16s 27848KB
stdin
Standard input is empty
stdout
0.06977041810750961
0.07760106027126312