[PATCH] D35145: Use emplace_back to replace size() and resize().

Dehao Chen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 9 06:14:40 PDT 2017


danielcdh created this revision.
Herald added a subscriber: sanjoy.

This speeds-up thin-link for ~29% for large programs.


https://reviews.llvm.org/D35145

Files:
  tools/gold/gold-plugin.cpp


Index: tools/gold/gold-plugin.cpp
===================================================================
--- tools/gold/gold-plugin.cpp
+++ tools/gold/gold-plugin.cpp
@@ -477,7 +477,7 @@
 
   std::unique_ptr<InputFile> Obj = std::move(*ObjOrErr);
 
-  Modules.resize(Modules.size() + 1);
+  Modules.emplace_back();
   claimed_file &cf = Modules.back();
 
   cf.handle = file->handle;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35145.105699.patch
Type: text/x-patch
Size: 381 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170709/339e0f07/attachment-0001.bin>


More information about the llvm-commits mailing list