* Performance improvement: don't register already registered terms,

thus greatly reducing the number of db transactions.
This commit is contained in:
Eelco Dolstra 2003-10-10 13:22:29 +00:00
parent 08b7319f5b
commit 1eb4da156c

View file

@ -37,12 +37,15 @@ Path writeTerm(ATerm t, const string & suffix)
Path path = canonPath(nixStore + "/" + Path path = canonPath(nixStore + "/" +
(string) h + suffix + ".nix"); (string) h + suffix + ".nix");
if (!ATwriteToNamedTextFile(t, path.c_str()))
throw Error(format("cannot write aterm %1%") % path);
Transaction txn(nixDB); if (!isValidPath(path)) {
registerValidPath(txn, path); if (!ATwriteToNamedTextFile(t, path.c_str()))
txn.commit(); throw Error(format("cannot write aterm %1%") % path);
Transaction txn(nixDB);
registerValidPath(txn, path);
txn.commit();
}
return path; return path;
} }