[lld] [ELF] Avoid repeated scans when merging strings (PR #219071)

Farid Zakaria via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 26 20:53:43 PDT 2026


fzakaria wrote:

Regarding the notes, I rather keep them in the PR description. If they are problematic, they can be removed before merging. I prefer to keep all relevant and salient information top-posted so it's easy to read and find -- as opposed to digging through comments (which at some point GitHub chooses to make invisible)

As for this change:

> Then what's the point of this change that significantly increases code complexity? FWIW I've also tried optimizing this function but haven't managed to do so...

I was being forthcoming that I ran it on _a single_ workload that we have which is large and string merging was not the bottleneck so it did not improve _that single albeit important workload_ :/

I thought despite that, there is a pretty clear demonstrable improvement for the function (>20% for CPU) which would improve the headroom on remote builders to take on additional work. (https://en.wikipedia.org/wiki/Jevons_paradox)
I would say this PR does achieve such optimization you've sought with a fixed memory cost to boot. :shrug: 

I fuond the complexity here relatively small; it's an intrusive linked list that is precalculated before the concurrent run to avoid unecessary scanning. It's < 50 lines (with some pretty aggressive braces)

I see you've requested changes, but I am not sure what changes you are seeking.
Please let me know.

@rui314  thanks for the tip -- I will look into that if there's a willingness upstream.

https://github.com/llvm/llvm-project/pull/219071


More information about the llvm-commits mailing list