[tbb-commits] [tor-browser] 13/179: Bug 1773222 - Speed up gn config filtering. r=firefox-build-system-reviewers, andi a=pascalc

gitolite role git at cupani.torproject.org
Fri Aug 19 08:35:10 UTC 2022


This is an automated email from the git hooks/post-receive script.

pierov pushed a commit to branch tor-browser-102.2.0esr-12.0-1
in repository tor-browser.

commit 5b2984d90280946f4a681dc84be2eadbe4caccdf
Author: Mike Hommey <mh+mozilla at glandium.org>
AuthorDate: Wed Jun 8 08:49:06 2022 +0000

    Bug 1773222 - Speed up gn config filtering. r=firefox-build-system-reviewers,andi a=pascalc
    
    This brings down the operation from 12s to 8ms on my machine. Yes,
    that's seconds versus milliseconds.
    
    Differential Revision: https://phabricator.services.mozilla.com/D148624
---
 python/mozbuild/mozbuild/gn_processor.py | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/python/mozbuild/mozbuild/gn_processor.py b/python/mozbuild/mozbuild/gn_processor.py
index 4ad07035eb092..6e3f2146b97ac 100644
--- a/python/mozbuild/mozbuild/gn_processor.py
+++ b/python/mozbuild/mozbuild/gn_processor.py
@@ -4,7 +4,7 @@
 
 from __future__ import absolute_import, print_function, unicode_literals
 
-from collections import defaultdict
+from collections import defaultdict, deque
 from copy import deepcopy
 import glob
 import json
@@ -141,10 +141,14 @@ class MozbuildWriter(object):
 
 
 def find_deps(all_targets, target):
-    all_deps = set([target])
-    for dep in all_targets[target]["deps"]:
-        if dep not in all_deps:
-            all_deps |= find_deps(all_targets, dep)
+    all_deps = set()
+    queue = deque([target])
+    while queue:
+        item = queue.popleft()
+        all_deps.add(item)
+        for dep in all_targets[item]["deps"]:
+            if dep not in all_deps:
+                queue.append(dep)
     return all_deps
 
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the tbb-commits mailing list