[PATCH] D46145: Use a buffer when allocating relocations

Rafael Avila de Espindola via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 27 08:28:06 PDT 2018


espindola added a comment.

In https://reviews.llvm.org/D46145#1081118, @grimar wrote:

> In https://reviews.llvm.org/D46145#1081117, @ruiu wrote:
>
> > I wonder if you can make a guess on how many relocations will be inserted to the vector. We know the number of relocations for each input section, so calling reserve() might work.
>
>
> I think `reserve()` is exactly what causes high peaks now. We already call it. See:
>  https://github.com/llvm-mirror/lld/blob/master/ELF/Relocations.cpp#L1020


Yes, currently using reserve is critical for performance, but wastes memory.


https://reviews.llvm.org/D46145





More information about the llvm-commits mailing list