`ConcatInputSection::foldIdentical()` clears the folded functions `originalUnwindEntry`. However, it cleared every symbol: with N members, the repeated clearing is **O(N²)**. This is redundant: we should only remove the incoming `copy->symbols`. This patch moves the removing loop ahead and adds more clear comments on why we need to skip the first element. Also added a new `lld/test/MachO/icf-scale-same-class.s` with 500K identical functions as a stress test, which would've taken minutes to link, and less than a second with the patch. Testing on real-world app (IRPGO instrumentation + ICF) find that we achieved a 19x speed up (1:14:42 -> 3:55) |
||
|---|---|---|
| .. | ||
| COFF | ||
| ELF | ||
| MachO | ||
| MinGW | ||
| Unit | ||
| wasm | ||
| CMakeLists.txt | ||
| lit.cfg.py | ||
| lit.site.cfg.py.in | ||