commit b56e301ec7970b51f49e6f3c43bf89eab13e376a
parent 19cda19b23183f8930b11734b39a00035847d43d
Author: serge-sans-paille <sguelton@mozilla.com>
Date: Mon, 1 Dec 2025 06:40:28 +0000
Bug 2002594 - Improve runtime performance of gecko_taskgraph.util.chunking.chunk_manifests r=jmaher,taskgraph-reviewers
- Current implementation uses an explicit loop where list comprehension
could be used.
- Also the final sorting is not exactly relevant (it mostly reverses the
order)
This saves ~80ms on task generation.
Differential Revision: https://phabricator.services.mozilla.com/D274152
Diffstat:
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/taskcluster/gecko_taskgraph/util/chunking.py b/taskcluster/gecko_taskgraph/util/chunking.py
@@ -187,16 +187,10 @@ def chunk_manifests(suite, platform, chunks, manifests):
for _, c in cbr.get_chunked_manifests(manifests)
]
+ # Keep track of test paths for each chunk, and the runtime information.
# Spread out the test manifests evenly across all chunks.
- chunked_manifests = [[] for _ in range(chunks)]
- for index, key in enumerate(sorted(manifests)):
- chunked_manifests[index % chunks].append(key)
-
- # One last sort by the number of manifests. Chunk size should be more or less
- # equal in size.
- chunked_manifests.sort(key=lambda x: len(x))
-
- # Return just the chunked test paths.
+ sorted_manifests = sorted(manifests)
+ chunked_manifests = [sorted_manifests[c::chunks] for c in range(chunks)]
return chunked_manifests