Step 4: fast against slow
English · Dansk · Bahasa Malaysia
@speed_calc_decorator above both functions of the assignment gives the expected output:

Run it with python -m speed_calc.
What we gained
- One decorator times any number of functions; the timing code is written once.
slow_function loops ten times as often as fast_function, so it takes about ten times as long. The numbers differ on every machine, but the ratio does not.
- A clean layout for a small exercise:
src/ for code, tests/ for tests, docs/ for documents, constants.py for constants, and Doxygen comments for the API.