Bug 1474524: Don't call contains() before adding an entry to the registry. r?mshal
It turns out that this check is the major bottleneck in this task. Simply
catching the error caused by the duplicate files has the same effect, but is
several orders of magnitude faster.
MozReview-Commit-ID: 8vFyQ7VVYRD
--- a/toolkit/mozapps/extensions/gen_built_in_addons.py
+++ b/toolkit/mozapps/extensions/gen_built_in_addons.py
@@ -37,18 +37,20 @@ def get_registry(paths):
used_paths.add(full_path)
reg = FileRegistry()
InstallManifest(full_path).populate_registry(reg)
for p, f in reg:
path = mozpath.join(base, p)
- if not registry.contains(path):
+ try:
registry.add(path, f)
+ except Exception:
+ pass
return registry, used_paths
def get_child(base, path):
"""Returns the nearest parent of `path` which is an immediate child of
`base`"""