[WebAssembly] Remove premature optimization.

I think calling reserve() for each object file is too many and isn't useful.
We can add reserve() later. By default, we shouldn't add reserve() to a lot
of places.

Differential Revision: https://reviews.llvm.org/D43722

llvm-svn: 326273
This commit is contained in:
Rui Ueyama 2018-02-28 00:15:59 +00:00
parent bb333c26ed
commit da69b711c9
1 changed files with 1 additions and 1 deletions

View File

@ -895,11 +895,11 @@ void Writer::createCtorFunction() {
void Writer::calculateInitFunctions() {
for (ObjFile *File : Symtab->ObjectFiles) {
const WasmLinkingData &L = File->getWasmObj()->linkingData();
InitFunctions.reserve(InitFunctions.size() + L.InitFunctions.size());
for (const WasmInitFunc &F : L.InitFunctions)
InitFunctions.emplace_back(
WasmInitEntry{File->getFunctionSymbol(F.Symbol), F.Priority});
}
// Sort in order of priority (lowest first) so that they are called
// in the correct order.
std::stable_sort(InitFunctions.begin(), InitFunctions.end(),