commit cd3318ee495f22b8b89a1328da1bbec34230098b
parent d1f56fdedc0d4787b7afe8f7e8a2eaeb3b8826f6
Author: serge-sans-paille <sguelton@mozilla.com>
Date: Wed, 3 Dec 2025 17:14:56 +0000
Bug 2003240 - Optimize skip-if to avoid redundant dictionary lookup r=jcristau
This saves ~90ms during task graph construction
% hyperfine -L branch experiment/try-validate^,experiment/try-validate -w1 -r5 -s 'git checkout {branch}' 'TASKGRAPH_SERIAL=1 ./mach taskgraph full -k mochitest
Benchmark 1: TASKGRAPH_SERIAL=1 ./mach taskgraph full -k mochitest (branch = experiment/try-validate^)
Time (mean ± σ): 19.471 s ± 0.102 s [User: 19.719 s, System: 2.909 s]
Range (min … max): 19.386 s … 19.640 s 5 runs
Benchmark 2: TASKGRAPH_SERIAL=1 ./mach taskgraph full -k mochitest (branch = experiment/try-validate)
Time (mean ± σ): 18.381 s ± 0.172 s [User: 18.617 s, System: 2.849 s]
Range (min … max): 18.077 s … 18.500 s 5 runs
Summary
TASKGRAPH_SERIAL=1 ./mach taskgraph full -k mochitest (branch = experiment/try-validate) ran
1.06 ± 0.01 times faster than TASKGRAPH_SERIAL=1 ./mach taskgraph full -k mochitest (branch = experiment/try-validate^)
Differential Revision: https://phabricator.services.mozilla.com/D274558
Diffstat:
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/testing/mozbase/manifestparser/manifestparser/filters.py b/testing/mozbase/manifestparser/manifestparser/filters.py
@@ -33,12 +33,12 @@ def skip_if(tests, values, strict=False):
Sets disabled on all tests containing the `skip-if` tag and whose condition
is True. This filter is added by default.
"""
- tag = "skip-if"
for test in tests:
- if tag in test:
- matching_expr = _match(test[tag], strict, **values)
+ test_tag = test.get("skip_if")
+ if test_tag:
+ matching_expr = _match(test_tag, strict, **values)
if matching_expr:
- test.setdefault("disabled", f"{tag}: {matching_expr}")
+ test.setdefault("disabled", f"skip_if: {matching_expr}")
yield test