Skip to content

Commit

Permalink
Fix quadratic behavior in Repo._collect_stages() (iterative#3932)
Browse files Browse the repository at this point in the history
  • Loading branch information
Suor authored Jun 2, 2020
1 parent 7504b68 commit fd65f44
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions dvc/repo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,14 +527,13 @@ def _collect_stages(self):

for root, dirs, files in self.tree.walk(self.root_dir):
for file_name in filter(is_valid_filename, files):
path = os.path.join(root, file_name)
stages.extend(self.get_stages(path))
new_stages = self.get_stages(os.path.join(root, file_name))
stages.extend(new_stages)
outs.update(
out.fspath
for stage in stages
for out in (
out for out in stage.outs if out.scheme == "local"
)
for stage in new_stages
for out in stage.outs
if out.scheme == "local"
)
dirs[:] = [d for d in dirs if os.path.join(root, d) not in outs]
return stages
Expand Down

0 comments on commit fd65f44

Please sign in to comment.