1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-06 09:11:47 +02:00

OCD performance fix: {find,count}+insert => insert

This commit is contained in:
Eelco Dolstra 2019-10-09 15:51:52 +02:00
parent e6e61f0a54
commit 99b73fb507
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
16 changed files with 32 additions and 65 deletions

View file

@ -71,9 +71,7 @@ void printClosure(const Path & nePath, const StoreExpr & fs)
Path path = *(workList.begin());
workList.erase(path);
if (doneSet.find(path) == doneSet.end()) {
doneSet.insert(path);
if (doneSet.insert(path).second) {
ClosureElems::const_iterator elem = fs.closure.elems.find(path);
if (elem == fs.closure.elems.end())
throw Error(format("bad closure, missing path '%1%'") % path);
@ -104,8 +102,7 @@ void printDotGraph(ref<Store> store, const PathSet & roots)
Path path = *(workList.begin());
workList.erase(path);
if (doneSet.find(path) != doneSet.end()) continue;
doneSet.insert(path);
if (!doneSet.insert(path).second) continue;
cout << makeNode(path, symbolicName(path), "#ff0000");