You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Simplify normalize_perf now that pytest-perf resolves sub-microsecond timings #539
#533 added a normalize_perf exercise that repeats the operation 1000× to produce a measurable timing:
defnormalize_perf():
# python/cpython#143658importimportlib_metadata# end warmup# operation completes in < 1ms, so repeat it to get visibility# https://github.com/jaraco/pytest-perf/issues/12for_inrange(1000):
importlib_metadata.Prepared.normalize('sample')
The loop exists only because a single Prepared.normalize('sample') call runs well under a microsecond — below the resolution pytest-perf had at the time. It parsed timeit output into a microsecond-resolution datetime.timedelta, so sub-microsecond timings rounded to zero and the control/experiment comparison was meaningless.
As of pytest-perf 0.16.0, timings are compared with nanosecond precision (via tempora.Duration), resolving jaraco/pytest-perf#18. The amplification loop is no longer needed; normalize_perf can exercise a single call:
defnormalize_perf():
importimportlib_metadata# end warmupimportlib_metadata.Prepared.normalize('sample')
This would require pytest-perf >= 0.16 for the perf run.
Activity
Rely on pytest-perf 0.16 for nanosecond precision in performance tests.
Rely on pytest-perf 0.16 for nanosecond precision in performance tests.