Compute FS closures in parallel

This is much faster.
This commit is contained in:
Eelco Dolstra 2016-11-10 17:30:12 +01:00
parent b74e03a870
commit 2176c939fc
2 changed files with 3 additions and 5 deletions

View file

@ -5,7 +5,7 @@ with pkgs;
let let
# FIXME # FIXME
nix = builtins.storePath /nix/store/b554awsd9vssb936mb32icgpfbyifsai-nix-1.12pre1234_abcdef; nix = builtins.storePath /nix/store/cvrdgdx0gzdi0yf2831f4j98d518m3ln-nix-1.12pre1234_abcdef;
#lib.overrideDerivation nixUnstable (orig: { #lib.overrideDerivation nixUnstable (orig: {
# src = /home/eelco/Dev/nix; # src = /home/eelco/Dev/nix;
#}); #});

View file

@ -69,7 +69,7 @@ void mainWrapped(int argc, char * * argv)
auto localStore = openStore(); auto localStore = openStore();
std::string binaryCacheUri = argv[3]; std::string binaryCacheUri = argv[3];
if (hasSuffix(binaryCacheUri, "/")) binaryCacheUri.pop_back(); if (hasSuffix(binaryCacheUri, "/")) binaryCacheUri.pop_back();
auto binaryCache = openStoreAt(binaryCacheUri); auto binaryCache = openStore(binaryCacheUri);
struct CacheState struct CacheState
{ {
@ -83,9 +83,7 @@ void mainWrapped(int argc, char * * argv)
auto allowedPaths = tokenizeString<PathSet>(readFile(storePathsFile, true)); auto allowedPaths = tokenizeString<PathSet>(readFile(storePathsFile, true));
PathSet allowedPathsClosure; PathSet allowedPathsClosure;
for (auto & path : allowedPaths) binaryCache->computeFSClosure(allowedPaths, allowedPathsClosure);
if (!allowedPathsClosure.count(path))
binaryCache->computeFSClosure(path, allowedPathsClosure);
printMsg(lvlInfo, format("%d top-level paths, %d paths in closure") printMsg(lvlInfo, format("%d top-level paths, %d paths in closure")
% allowedPaths.size() % allowedPathsClosure.size()); % allowedPaths.size() % allowedPathsClosure.size());