[PATCH] D43722: [WebAssembly] Remove premature optimization.
Rui Ueyama via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 23 21:35:24 PST 2018
ruiu created this revision.
ruiu added a reviewer: sbc100.
Herald added subscribers: sunfish, aheejin, jgravelle-google, dschuff, jfb.
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.
https://reviews.llvm.org/D43722
Files:
lld/wasm/Writer.cpp
Index: lld/wasm/Writer.cpp
===================================================================
--- lld/wasm/Writer.cpp
+++ lld/wasm/Writer.cpp
@@ -924,11 +924,11 @@
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(),
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43722.135779.patch
Type: text/x-patch
Size: 725 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180224/c85205cb/attachment.bin>
More information about the llvm-commits
mailing list