-
Type:
Improvement
-
Resolution: Fixed
-
Priority:
Trivial - P5
-
Affects Version/s: None
-
Component/s: Internal Code
-
None
-
Query Execution
-
Fully Compatible
-
QE 2024-12-09, QE 2024-12-23
-
None
-
3
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Some code parts use `std::vector::emplace_back(...)` in a non-efficient way.
Instead of passing the arguments for constructing the object in-place, we are passing a temporary object. The temporary object will then be std::moved into the vector by the `emplace_back` call. This can be improved by just passing the arguments to construct the object in-place.
For example, instead of
std::vector<LiteParsedPipeline> liteParsedPipelines; ... liteParsedPipelines.emplace_back(LiteParsedPipeline(nss, rawPipeline.second));
we could do
std::vector<LiteParsedPipeline> liteParsedPipelines; ... liteParsedPipelines.emplace_back(nss, rawPipeline.second);
This avoids calling the move ctor in addition to the object creation.
We have this pattern in several places in the code. We should fix the easy-to-identify ones.