tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit e9e57201f94e5d16cbed90be6bc980a0649a155f
parent 892f5db36050993a531af8d7d8ba1b13a9687944
Author: serge-sans-paille <sguelton@mozilla.com>
Date:   Fri, 19 Dec 2025 22:53:57 +0000

Bug 2002801 - Improve taskgraph.transforms.cached_tasks.order_tasks algorithm r=taskgraph-reviewers,ahal

Avoiding the repeated creation of a temporary set leads to a nice 110ms
saving.

% hyperfine -L branch bug/2002801^,bug/2002801 -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/2002801^)
  Time (mean ± σ):     23.509 s ±  0.128 s    [User: 23.368 s, System: 2.764 s]
  Range (min … max):   23.348 s … 23.691 s    5 runs

Benchmark 2: TASKGRAPH_SERIAL=1 ./mach taskgraph full -k mochitest (branch = bug/2002801)
  Time (mean ± σ):     23.399 s ±  0.162 s    [User: 23.239 s, System: 2.750 s]
  Range (min … max):   23.137 s … 23.530 s    5 runs

Summary
  TASKGRAPH_SERIAL=1 ./mach taskgraph full -k mochitest (branch = bug/2002801) ran
    1.00 ± 0.01 times faster than TASKGRAPH_SERIAL=1 ./mach taskgraph full -k mochitest (branch = bug/2002801^)

Differential Revision: https://phabricator.services.mozilla.com/D274299

Diffstat:
Mtaskcluster/gecko_taskgraph/transforms/cached_tasks.py | 10++++------
1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/taskcluster/gecko_taskgraph/transforms/cached_tasks.py b/taskcluster/gecko_taskgraph/transforms/cached_tasks.py @@ -20,17 +20,15 @@ def order_tasks(config, tasks): pending = deque(tasks) task_labels = {task["label"] for task in pending} emitted = set() - while True: - try: - task = pending.popleft() - except IndexError: - break + while pending: + task = pending.popleft() parents = { task for task in task.get("dependencies", {}).values() + if task in task_labels if task.startswith(kind_prefix) } - if parents and not emitted.issuperset(parents & task_labels): + if parents and not emitted.issuperset(parents): pending.append(task) continue emitted.add(task["label"])