llvm-project
9baf7017 - [ELF] Parallelize symbol interning while parsing files. NFC (#238701)

Commit
9 days ago
[ELF] Parallelize symbol interning while parsing files. NFC (#238701) Looking up global symbol names in the symbol table dominates the serial doParseFiles loop, mostly through cache misses. Shard the global symbol map and let helper threads run ahead of the loop, interning the names of relocatable object files in input order. Before parsing a file, the loop waits for the helper that claimed it, or claims the file and inserts its symbols serially. An interned symbol is invisible to find() until SymbolTable::insert appends it to symVector, and resolution stays serial, so the output is unchanged. The shards are locked only while the helpers run. ``` Chromium clang (release) --threads link (ms) parse link (ms) parse 1 +30 (+0.8%) 659 -> 690 +3 (+0.7%) 49 -> 52 2 2724 -> 2502 (-8%) 663 -> 455 347 -> 337 (-3.5%) 50 -> 40 8 1767 -> 1412 (-20%) 667 -> 313 181 -> 151 (-17%) 56 -> 24 16 1692 -> 1315 (-21%) 688 -> 326 159 -> 136 (-14%) 50 -> 25 ```
Author
Parents
Loading