def _timeit_fast(stmt='pass', setup='pass', repeat=3):
 timer = timeit.Timer(stmt, setup)
 x = 0
 for p in range(0, 10):
  number = (10 ** p)
  x = timer.timeit(number)
  if (x >= (0.005 / 10)):
   break
 if (x > 1):
  best = x
 else:
  number *= 10
  r = timer.repeat(repeat, number)
  best = min(r)
 sec = (best / number)
 return sec

def _timeit_fast ( stmt = 'pass' , setup = 'pass' , repeat = 3 ) : timer = timeit . Timer ( stmt , setup ) x = 0 for p in range ( 0 , 10 ) : number = ( 10 ** p ) x = timer . timeit ( number ) if ( x >= ( 0.005 / 10 ) ) : break if ( x > 1 ) : best = x else : number *= 10 r = timer . repeat ( repeat , number ) best = min ( r ) sec = ( best / number ) return sec
returns the time the statement/function took .