Skip to content

Commit 04159b2

Browse files
Perf: Build comparator registry only once before iterating over all files (#87)
1 parent 15264bf commit 04159b2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

dir_content_diff/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,10 @@ def compare_trees(
333333
for pattern in v.pop("patterns", []):
334334
pattern_specific_args[re.compile(pattern)] = v
335335

336+
# Build the comparator registry if not given
337+
if comparators is None:
338+
comparators = get_comparators()
339+
336340
# Loop over all files and call the correct comparator
337341
different_files = {}
338342
for ref_file in ref_path.glob("**/*"):

0 commit comments

Comments
 (0)