# pytest_benchmark.fixture.BenchmarkFixture: Benchmark 'test_sort' failed: 5.21ms > 5.00ms (threshold)

- **ID:** `python/pytest-benchmark-flaky-threshold`
- **Domain:** python
- **Category:** system_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

pytest-benchmark's --benchmark-max-time or comparison threshold is too tight for noisy CI hardware; a few microseconds of variance trips the gate.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 4.0.x | active | — | — |

## Workarounds

1. **** (90% success)
   ```
   pytest --benchmark-only \
  --benchmark-compare=baseline \
  --benchmark-compare-fail=median:15%
   ```
2. **** (87% success)
   ```
   pytest --benchmark-only --benchmark-disable-gc \
  --benchmark-save=ci-$CI_RUN_ID
# Compare offline; only fail on >25% median regression
   ```

## Dead Ends

- **** — Disables the benchmark entirely; performance regressions no longer surface. (80% fail)
- **** — Test ordering isn't the cause; hardware variance and CPU steal still produce flaky results. (70% fail)
