From 91d67692cfb05e4ece744fb9d144921ae920f2de Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 16 Mar 2017 12:05:51 +0100 Subject: [PATCH] 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(+) diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc index 9c755965e..9ab3f3632 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; },