mirror of
https://github.com/NixOS/nix.git
synced 2025-11-14 22:42:41 +01:00
OCD performance fix: {find,count}+insert => insert
This commit is contained in:
parent
e6e61f0a54
commit
99b73fb507
16 changed files with 32 additions and 65 deletions
|
|
@ -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");
|
||||
|
||||
|
|
|
|||
|
|
@ -242,11 +242,10 @@ const string treeNull = " ";
|
|||
static void printTree(const Path & path,
|
||||
const string & firstPad, const string & tailPad, PathSet & done)
|
||||
{
|
||||
if (done.find(path) != done.end()) {
|
||||
if (!done.insert(path).second) {
|
||||
cout << format("%1%%2% [...]\n") % firstPad % path;
|
||||
return;
|
||||
}
|
||||
done.insert(path);
|
||||
|
||||
cout << format("%1%%2%\n") % firstPad % path;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue