Details
Description
While profiling QBS on pretty large project I noticed that the function causing a huge slowdown is allChildrenBuilt function in lib/corelib/buildgraph/executor.cpp. The function is pretty simple:
foreach (BuildGraphNode *child, node->children) if (child->buildState != BuildGraphNode::Built) return false; return true;
The problem is that node->children is std::set and thus deep-copy on it is performed each time Qt foreach is done. After changing it to iterator based loop, performance seriously improved. But that isn't the only place where foreach is used on std::set.
Suggested workarounds:
- Change every usage of std::set to QSet
- Carefully find all foreach used on std::set and change them to iterator based for