[lld] r326273 - [WebAssembly] Remove premature optimization.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 27 16:15:59 PST 2018


Author: ruiu
Date: Tue Feb 27 16:15:59 2018
New Revision: 326273

URL: http://llvm.org/viewvc/llvm-project?rev=326273&view=rev
Log:
[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

Modified:
    lld/trunk/wasm/Writer.cpp

Modified: lld/trunk/wasm/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/Writer.cpp?rev=326273&r1=326272&r2=326273&view=diff
==============================================================================
--- lld/trunk/wasm/Writer.cpp (original)
+++ lld/trunk/wasm/Writer.cpp Tue Feb 27 16:15:59 2018
@@ -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(),




More information about the llvm-commits mailing list