[PATCH] D46145: Use a buffer when allocating relocations
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 27 05:06:54 PDT 2018
grimar added a comment.
I confirm the peak allocation difference. I think that implementation can be a bit simpler though, my suggestion is below.
================
Comment at: ELF/Writer.cpp:875
+ };
+
// Scan all relocations. Each relocation goes through a series
----------------
It can be a bit simpler I think:
(RAM profiling shows that the version below consume the same amount of memory).
```
std::vector<Relocation> Buffer;
// <new comment>
auto WithBuffer = [&](InputSectionBase &Sec) {
Fn(Sec);
Buffer = std::move(Sec.Relocations);
Sec.Relocations = Buffer;
};
```
https://reviews.llvm.org/D46145
More information about the llvm-commits
mailing list