MCPcopy Index your code
hub / github.com/RustPython/RustPython / _test_generator

Function _test_generator

Lib/random.py:962–976  ·  view source on GitHub ↗
(n, func, args)

Source from the content-addressed store, hash-verified

960## ----------------- test program -----------------------
961
962def _test_generator(n, func, args):
963 from statistics import stdev, fmean as mean
964 from time import perf_counter
965
966 t0 = perf_counter()
967 data = [func(*args) for i in _repeat(None, n)]
968 t1 = perf_counter()
969
970 xbar = mean(data)
971 sigma = stdev(data, xbar)
972 low = min(data)
973 high = max(data)
974
975 print(f'{t1 - t0:.3f} sec, {n} times {func.__name__}{args!r}')
976 print('avg %g, stddev %g, min %g, max %g\n' % (xbar, sigma, low, high))
977
978
979def _test(N=10_000):

Callers 1

_testFunction · 0.85

Calls 7

perf_counterFunction · 0.90
meanFunction · 0.90
stdevFunction · 0.90
minFunction · 0.85
maxFunction · 0.85
funcFunction · 0.50
printFunction · 0.50

Tested by

no test coverage detected