Skip to content

Commit ef51849

Browse files
authored
ci: give the release comparison its own one-model edit limit (#1040)
One-model edit compiles may run up to 1.25x the previous release until native rendering is the default; cold and warm compiles keep 1.15x.
1 parent 450b807 commit ef51849

4 files changed

Lines changed: 74 additions & 2 deletions

File tree

‎.github/workflows/release-performance.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ jobs:
6363
run: uv sync --locked --all-groups --all-extras
6464
- name: Build candidate wheel
6565
run: uv build --wheel --out-dir "${RUNNER_TEMP}/candidate"
66+
# Temporary: one-model edit compiles use MAX_EDIT_COMPILE_TIME_RATIO (1.25x) because an edited
67+
# model recompiles uncached; tighten it back to 1.15x once native rendering is the default.
6668
- name: Compare candidate and previous release on this runner
6769
env:
6870
BASELINE: ${{ inputs.baseline }}

‎scripts/release_performance/constants.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
MAX_CPU_RATIO: float = 1.25
1313
MAX_RSS_RATIO: float = 1.25
1414
MAX_COMPILE_TIME_RATIO: float = 1.15
15+
MAX_EDIT_COMPILE_TIME_RATIO: float = 1.25
1516
MIN_WALL_REGRESSION_SECONDS: float = 0.5
1617
MIN_CPU_REGRESSION_SECONDS: float = 0.5
1718
MIN_RSS_REGRESSION_BYTES: int = 32 * 1024 * 1024
@@ -118,7 +119,7 @@
118119
project=INSPECTION_PROJECT,
119120
sqb_args=("compile", "--json"),
120121
edits_model=True,
121-
max_time_ratio=MAX_COMPILE_TIME_RATIO,
122+
max_time_ratio=MAX_EDIT_COMPILE_TIME_RATIO,
122123
),
123124
BenchmarkCommand(
124125
name="dense compile (warm cache)",
@@ -131,7 +132,7 @@
131132
project=DENSE_PROJECT,
132133
sqb_args=("compile", "--json"),
133134
edits_model=True,
134-
max_time_ratio=MAX_COMPILE_TIME_RATIO,
135+
max_time_ratio=MAX_EDIT_COMPILE_TIME_RATIO,
135136
),
136137
BenchmarkCommand(
137138
name="dense compile (no cache)",

‎tests/unit/scripts/release_performance/_helpers/_test_types.py‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ class MetricVerdictTestCase:
1212
expected_regressed: tuple[bool, bool, bool]
1313

1414

15+
@dataclass(frozen=True)
16+
class ConfiguredTimeLimitTestCase:
17+
description: str
18+
command: str
19+
wall_ratio: float
20+
expected_regressed: bool
21+
22+
1523
@dataclass(frozen=True)
1624
class SkipReasonTestCase:
1725
description: str

‎tests/unit/scripts/release_performance/_helpers/test_verdict.py‎

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
regression_messages,
88
skip_reason,
99
)
10+
from scripts.release_performance.constants import BENCHMARK_COMMANDS
1011
from scripts.release_performance.models import BenchmarkCommand, MetricVerdict
1112
from tests.unit.scripts.release_performance._helpers._test_types import (
13+
ConfiguredTimeLimitTestCase,
1214
MetricVerdictTestCase,
1315
SkipReasonTestCase,
1416
)
@@ -221,5 +223,64 @@ def test_given_command_minimum_version_when_checking_versions_then_explains_skip
221223
assert reason == test_case.expected_reason
222224

223225

226+
@pytest.mark.parametrize(
227+
"test_case",
228+
(
229+
ConfiguredTimeLimitTestCase(
230+
description="a dense one-model edit within the edit limit passes",
231+
command="dense compile (one-model edit)",
232+
wall_ratio=1.232,
233+
expected_regressed=False,
234+
),
235+
ConfiguredTimeLimitTestCase(
236+
description="a one-model edit within the edit limit passes",
237+
command="compile (one-model edit)",
238+
wall_ratio=1.24,
239+
expected_regressed=False,
240+
),
241+
ConfiguredTimeLimitTestCase(
242+
description="a dense one-model edit beyond the edit limit fails",
243+
command="dense compile (one-model edit)",
244+
wall_ratio=1.26,
245+
expected_regressed=True,
246+
),
247+
ConfiguredTimeLimitTestCase(
248+
description="an unchanged warm compile keeps the tighter compile limit",
249+
command="dense compile (warm cache)",
250+
wall_ratio=1.232,
251+
expected_regressed=True,
252+
),
253+
ConfiguredTimeLimitTestCase(
254+
description="a cold compile keeps the tighter compile limit",
255+
command="dense compile (no cache)",
256+
wall_ratio=1.16,
257+
expected_regressed=True,
258+
),
259+
),
260+
ids=lambda case: case.description,
261+
)
262+
def test_given_configured_command_when_judging_time_then_its_own_limit_applies(
263+
test_case: ConfiguredTimeLimitTestCase,
264+
) -> None:
265+
configured: BenchmarkCommand = {command.name: command for command in BENCHMARK_COMMANDS}[
266+
test_case.command
267+
]
268+
wall: float = 10.0 * test_case.wall_ratio
269+
270+
verdicts: tuple[MetricVerdict, ...] = metric_verdicts(
271+
comparison=comparison(
272+
name=configured.name,
273+
baseline=((10.0, 10.0, 400),) * 3,
274+
candidate=((wall, wall, 400),) * 3,
275+
max_time_ratio=configured.max_time_ratio,
276+
)
277+
)
278+
279+
assert (verdicts[0].regressed, verdicts[1].regressed) == (
280+
test_case.expected_regressed,
281+
test_case.expected_regressed,
282+
)
283+
284+
224285
if __name__ == "__main__":
225286
pytest.main([__file__, "-vv"])

0 commit comments

Comments
 (0)