Add GZip event-loop responsiveness benchmark
Merged
KL
3mo ago+139+139+012345678901234567890123456789-1-1-0123456789
Summary
- add a CodSpeed benchmark for GZipMiddleware event-loop responsiveness
- schedule a 10 MiB JSON response immediately before a tiny bypass response
- measure only the work required for the tiny response to complete
- drain and validate the large response during benchmark teardown
- document how the responsiveness and total-completion benchmarks complement each other
Rationale
Large inline gzip operations can delay unrelated event-loop work. A wall-clock benchmark would be noisy on shared GitHub runners, while CodSpeed walltime runners are unavailable to repositories owned by personal accounts.
This benchmark instead gives CodSpeed simulation a deterministic measurement boundary: FIFO task scheduling starts the large response first, then the tiny response, and the measured target returns when the tiny response completes. Payload construction, event-loop creation, worker startup, draining, and validation remain outside the measured region. The existing json-10MiB-level-9 benchmark continues to measure total response completion separately.
Validation
uv run pytest benchmarks/gzip_benchmark.py -q- responsiveness benchmark under pytest-codspeed walltime, simulation, and memory lifecycles
scripts/check