diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2019-10-09 15:51:52 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2019-10-09 16:06:29 +0200 |
commit | 99b73fb5071db9fd757c9927fc3fde34e2abac63 (patch) | |
tree | fb50f681aced9f566da52aaf22eb4275471d010a /src/nix-store/dotgraph.cc | |
parent | e6e61f0a54dac0174df996e93fcfedcac7769ab4 (diff) |
OCD performance fix: {find,count}+insert => insert
Diffstat (limited to 'src/nix-store/dotgraph.cc')
-rw-r--r-- | src/nix-store/dotgraph.cc | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/nix-store/dotgraph.cc b/src/nix-store/dotgraph.cc index abdfa5e58..d448654fe 100644 --- a/src/nix-store/dotgraph.cc +++ b/src/nix-store/dotgraph.cc @@ -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"); |