diff options
author | Fangrui Song <i@maskray.me> | 2021-12-25 23:16:26 -0800 |
---|---|---|
committer | Fangrui Song <i@maskray.me> | 2021-12-25 23:16:27 -0800 |
commit | 2c8ebab32eadbc749e669a6529d6a40929ae5d14 (patch) | |
tree | 2abe8f000b9b3651bd714239942ecc7d0f01e6ec /lld/ELF/SyntheticSections.cpp | |
parent | d5e310b154351e28f56fbf3c5401da63caef2f98 (diff) | |
download | llvm-2c8ebab32eadbc749e669a6529d6a40929ae5d14.zip llvm-2c8ebab32eadbc749e669a6529d6a40929ae5d14.tar.gz llvm-2c8ebab32eadbc749e669a6529d6a40929ae5d14.tar.bz2 |
[ELF] sortSymTabSymbols: change vector to SmallVector
This function may take ~1% time. SmallVector<SymbolTableEntry, 0> is smaller (16 bytes
instead of 24) and more efficient.
Diffstat (limited to 'lld/ELF/SyntheticSections.cpp')
-rw-r--r-- | lld/ELF/SyntheticSections.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp index e480118..b877509 100644 --- a/lld/ELF/SyntheticSections.cpp +++ b/lld/ELF/SyntheticSections.cpp @@ -2127,12 +2127,12 @@ void SymbolTableBaseSection::sortSymTabSymbols() { // symbols, they are already naturally placed first in each group. That // happens because STT_FILE is always the first symbol in the object and hence // precede all other local symbols we add for a file. - MapVector<InputFile *, std::vector<SymbolTableEntry>> arr; + MapVector<InputFile *, SmallVector<SymbolTableEntry, 0>> arr; for (const SymbolTableEntry &s : llvm::make_range(symbols.begin(), e)) arr[s.sym->file].push_back(s); auto i = symbols.begin(); - for (std::pair<InputFile *, std::vector<SymbolTableEntry>> &p : arr) + for (auto &p : arr) for (SymbolTableEntry &entry : p.second) *i++ = entry; } |