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.
This commit is contained in:
parent
ea7fa88131
commit
91d67692cf
|
@ -822,6 +822,7 @@ void copyPaths(ref<Store> from, ref<Store> to, const Paths & storePaths, bool su
|
||||||
PathSet(storePaths.begin(), storePaths.end()),
|
PathSet(storePaths.begin(), storePaths.end()),
|
||||||
|
|
||||||
[&](const Path & storePath) {
|
[&](const Path & storePath) {
|
||||||
|
if (to->isValidPath(storePath)) return PathSet();
|
||||||
return from->queryPathInfo(storePath)->references;
|
return from->queryPathInfo(storePath)->references;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue