commit 82874a096b1c7e7123087c6b7b3d8b21b47503a8
parent 552c14b2d6b71939e95cfef0f6300721460a4939
Author: serge-sans-paille <sguelton@mozilla.com>
Date: Tue, 16 Dec 2025 15:28:54 +0000
Bug 2003034 - Change ordering of test filters to apply the more aggressive one first r=jcristau,taskgraph-reviewers
Experimental measurement shows that for full graph computation, it's
faster to filter by tags first, thus using the `extra' tests first.
This saves around 730ms during taskgraph build.
% hyperfine -L branch bug/2003034^,bug/2003034 -w1 -r5 -s 'git checkout {branch}' 'TASKGRAPH_SERIAL=1 ./mach taskgraph full'
Benchmark 1: TASKGRAPH_SERIAL=1 ./mach taskgraph full (branch = bug/2003034^)
Time (mean ± σ): 68.209 s ± 0.639 s [User: 66.996 s, System: 4.318 s]
Range (min … max): 67.370 s … 69.035 s 5 runs
Benchmark 2: TASKGRAPH_SERIAL=1 ./mach taskgraph full (branch = bug/2003034)
Time (mean ± σ): 67.463 s ± 0.375 s [User: 66.367 s, System: 4.272 s]
Range (min … max): 66.807 s … 67.733 s 5 runs
Summary
TASKGRAPH_SERIAL=1 ./mach taskgraph full (branch = bug/2003034) ran
1.01 ± 0.01 times faster than TASKGRAPH_SERIAL=1 ./mach taskgraph full (branch = bug/2003034^)
Differential Revision: https://phabricator.services.mozilla.com/D274445
Diffstat:
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/testing/mozbase/manifestparser/manifestparser/manifestparser.py b/testing/mozbase/manifestparser/manifestparser/manifestparser.py
@@ -905,7 +905,7 @@ class TestManifest(ManifestParser):
:param exists: filter out non-existing tests (default True)
:param disabled: whether to return disabled tests (default True)
:param values: keys and values to filter on (e.g. `os = linux mac`)
- :param filters: list of filters to apply to the tests
+ :param filters: list of filters to apply to the tests. Applied before any others
:returns: list of test objects that were not filtered out
"""
tests = [i.copy() for i in self.tests] # shallow copy
@@ -915,10 +915,15 @@ class TestManifest(ManifestParser):
test["expected"] = test.get("expected", "pass")
# make a copy so original doesn't get modified
- if noDefaultFilters:
- fltrs = []
+ if filters:
+ # Insert them before any other tests, experimental setup shows they
+ # filter more stuff in the default, full & costly setup.
+ fltrs = filters[:]
else:
- fltrs = self.filters[:]
+ fltrs = []
+
+ if not noDefaultFilters:
+ fltrs.extend(self.filters)
if exists:
if self.strict:
@@ -929,10 +934,7 @@ class TestManifest(ManifestParser):
if not disabled:
fltrs.append(enabled)
- if filters:
- fltrs += filters
-
- self.last_used_filters = fltrs[:]
+ self.last_used_filters = fltrs
for fn in fltrs:
tests = fn(tests, values, strict=strictExpressions)
return list(tests)