From a91b198954a79f67900289eb2636adc7ab1f7e67 Mon Sep 17 00:00:00 2001 From: "Mr. Outis" Date: Fri, 10 May 2019 19:20:13 -0700 Subject: [PATCH] status: optimize the _fill_statuses method Close #1975 --- dvc/remote/local/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dvc/remote/local/__init__.py b/dvc/remote/local/__init__.py index 311309261b..45b1e4bbe6 100644 --- a/dvc/remote/local/__init__.py +++ b/dvc/remote/local/__init__.py @@ -383,8 +383,12 @@ def status( return ret def _fill_statuses(self, checksum_info_dir, local_exists, remote_exists): + # Using sets because they are way faster for lookups + local = set(local_exists) + remote = set(remote_exists) + for md5, info in checksum_info_dir.items(): - status = STATUS_MAP[(md5 in local_exists, md5 in remote_exists)] + status = STATUS_MAP[(md5 in local, md5 in remote)] info["status"] = status def _get_chunks(self, download, remote, status_info, status, jobs):