From 58ef4d9a95584fb89ebcf6222fbac6e698aa6b0b Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 11 Jul 2012 11:08:47 -0400 Subject: Add a function queryValidPaths() queryValidPaths() combines multiple calls to isValidPath() in one. This matters when using the Nix daemon because it reduces latency. For instance, on "nix-env -qas \*" it reduces execution time from 5.7s to 4.7s (which is indistinguishable from the non-daemon case). --- src/libstore/local-store.cc | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/libstore/local-store.cc') diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc index 89c5279b1..e3d23fdfb 100644 --- a/src/libstore/local-store.cc +++ b/src/libstore/local-store.cc @@ -744,6 +744,15 @@ bool LocalStore::isValidPath(const Path & path) } +PathSet LocalStore::queryValidPaths(const PathSet & paths) +{ + PathSet res; + foreach (PathSet::const_iterator, i, paths) + if (isValidPath(*i)) res.insert(*i); + return res; +} + + PathSet LocalStore::queryAllValidPaths() { SQLiteStmt stmt; -- cgit v1.2.3