Kaydet (Commit) 578e4eca authored tarafından Takeshi Abe's avatar Takeshi Abe Kaydeden (comit) Julien Nabet

sccomp: Reserve enough space at once for micro-optimization

Change-Id: Ib4e178d2a0f09cb44854f1d1aad026d8394a8917
Reviewed-on: https://gerrit.libreoffice.org/56312Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
Reviewed-by: 's avatarJulien Nabet <serval2412@yahoo.fr>
üst aae64e0f
......@@ -63,6 +63,7 @@ void SAL_CALL CoinMPSolver::solve()
// collect variables in vector (?)
std::vector<table::CellAddress> aVariableCells;
aVariableCells.reserve(maVariables.getLength());
for (sal_Int32 nPos=0; nPos<maVariables.getLength(); nPos++)
aVariableCells.push_back( maVariables[nPos] );
size_t nVariables = aVariableCells.size();
......
......@@ -76,6 +76,7 @@ public:
// Initialize population with individuals that have been initialized with uniform random
// noise
// uniform noise means random value inside your search space
maPopulation.reserve(mnPopulationSize);
for (size_t i = 0; i < mnPopulationSize; ++i)
{
maPopulation.emplace_back();
......
......@@ -100,6 +100,7 @@ void SAL_CALL LpsolveSolver::solve()
// collect variables in vector (?)
std::vector<table::CellAddress> aVariableCells;
aVariableCells.reserve(maVariables.getLength());
for (sal_Int32 nPos=0; nPos<maVariables.getLength(); nPos++)
aVariableCells.push_back( maVariables[nPos] );
size_t nVariables = aVariableCells.size();
......
......@@ -92,6 +92,7 @@ public:
mfBestFitness = std::numeric_limits<float>::lowest();
maSwarm.reserve(mnNumOfParticles);
for (size_t i = 0; i < mnNumOfParticles; i++)
{
maSwarm.emplace_back(mnDimensionality);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment