mirror of
https://github.com/NixOS/nix
synced 2025-06-25 10:41:16 +02:00
refactor(treewide): reserve vector capacity when final size is known
In these trivial cases the final vector size (or lower bound on the size) is known, so we can avoid some vector reallocations. This is not very important, but is just good practice and general hygiene.
This commit is contained in:
parent
492c678162
commit
0fe3b54ee1
6 changed files with 6 additions and 0 deletions
|
@ -91,6 +91,7 @@ StringMap EvalState::realiseContext(const NixStringContext & context, StorePathS
|
|||
|
||||
/* Build/substitute the context. */
|
||||
std::vector<DerivedPath> buildReqs;
|
||||
buildReqs.reserve(drvs.size());
|
||||
for (auto & d : drvs) buildReqs.emplace_back(DerivedPath { d });
|
||||
buildStore->buildPaths(buildReqs, bmNormal, store);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue