MCPcopy
hub / github.com/dabeaz/python-cookbook / test

Function test

src/14/make_your_programs_run_faster/example.py:2–8  ·  view source on GitHub ↗
(func)

Source from the content-addressed store, hash-verified

1import time
2def test(func):
3 start = time.time()
4 nums = range(1000000)
5 for n in range(100):
6 r = func(nums)
7 end = time.time()
8 print(func.__name__, ':', end-start)
9
10import math
11def compute_roots_1(nums):

Callers 1

example.pyFile · 0.70

Calls 1

funcFunction · 0.50

Tested by

no test coverage detected