tor-browser

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

commit 8ae0ce3e2f6171b34375001f209d584dd563b41a
parent 4528984ff4f0d4093010b7d7ada9ce9efb790a12
Author: Heitor Neiva <hneiva@mozilla.com>
Date:   Fri, 21 Nov 2025 14:30:45 +0000

Bug 2001437 - Optimize skip-unless-changed strategy r=ahal,taskgraph-reviewers

Saves about 0.5 seconds. yay

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

Diffstat:
Mtaskcluster/gecko_taskgraph/optimize/strategies.py | 17++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/taskcluster/gecko_taskgraph/optimize/strategies.py b/taskcluster/gecko_taskgraph/optimize/strategies.py @@ -82,12 +82,19 @@ class SkipUnlessHasRelevantTests(OptimizationStrategy): # in `gecko_taskgraph.register` at the same time. @register_strategy("skip-unless-changed") class SkipUnlessChanged(OptimizationStrategy): + @memoize + def _match_path(self, path, pattern): + return match_path(path, pattern) + def check(self, files_changed, patterns): - for pattern in patterns: - for path in files_changed: - if match_path(path, pattern): - return True - return False + """Optimized check using memoized path matching""" + # Check if any path matches any pattern + # short-circuits on first match via generator + return any( + self._match_path(path, pattern) + for path in files_changed + for pattern in patterns + ) def should_remove_task(self, task, params, file_patterns): # pushlog_id == -1 - this is the case when run from a cron.yml job or on a git repository