From 91d67692cfb05e4ece744fb9d144921ae920f2de Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 16 Mar 2017 12:05:51 +0100 Subject: copyPaths(): Don't query path info for a path the target already has For example, this cuts "nix-copy-closure --from" on a NixOS system closure from 15.9s to 0.5s. --- src/libstore/store-api.cc | 1 + 1 file changed, 1 insertion(+) (limited to 'src/libstore/store-api.cc') diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc index 9c755965e45b..9ab3f36329b4 100644 --- a/src/libstore/store-api.cc +++ b/src/libstore/store-api.cc @@ -822,6 +822,7 @@ void copyPaths(ref from, ref to, const Paths & storePaths, bool su PathSet(storePaths.begin(), storePaths.end()), [&](const Path & storePath) { + if (to->isValidPath(storePath)) return PathSet(); return from->queryPathInfo(storePath)->references; }, -- cgit 1.4.1