commit 49d9f91f4b46037dbb4f217dbbd8f97012598bc0
parent 1e92198df8e0dbfc1d6226e9db05769ab1439f6a
Author: serge-sans-paille <sguelton@mozilla.com>
Date: Mon, 8 Dec 2025 09:53:48 +0000
Bug 2003240 - Optimize skip-if to avoid redundant dictionary lookup r=jcristau
This saves ~140ms during task graph construction
hyperfine -L branch bug/2003240^,bug/2003240 -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 = bug/2003240^)
Time (mean ± σ): 23.333 s ± 0.368 s [User: 23.216 s, System: 2.762 s]
Range (min … max): 22.704 s … 23.645 s 5 runs
Benchmark 2: TASKGRAPH_SERIAL=1 ./mach taskgraph full -k mochitest (branch = bug/2003240)
Time (mean ± σ): 23.186 s ± 0.355 s [User: 23.123 s, System: 2.815 s]
Range (min … max): 22.567 s … 23.448 s 5 runs
Summary
TASKGRAPH_SERIAL=1 ./mach taskgraph full -k mochitest (branch = bug/2003240) ran
1.01 ± 0.02 times faster than TASKGRAPH_SERIAL=1 ./mach taskgraph full -k mochitest (branch = bug/2003240^)
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