[PATCH] D13743: Lazily sort ScopesWithImportedEntities to speed up LTO linking.

Ivan Krasin via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 16 15:59:15 PDT 2015


krasin added a comment.

Now, I have a better explanation what happens here.

1. As in trunk, stable_sort is called many times, requiring to do a lot of unnecessary work after each small update of the vector. The memory gets shuffled, the cache gets polluted, the time is wasted.

2. This CL only sorts, when it's really needed. While sorting puts the contents of the vector into the cache (thus evicting other useful info), these contents are immediately used by the caller of findImportedEntitiesForScope, so we actually warm up the cache!

3. I tried to place the sort invocation right after the loop in DwarfDebug::constructAndAddImportedEntityDIE, but then I realized that it's not correct, as findImportedEntitiesForScope could be called from within the loop. Also, that's actually slower than the current CL by 2 minutes.

Please, take another look.


http://reviews.llvm.org/D13743





More information about the llvm-commits mailing list