[PATCH] D57666: [LLD] [COFF] Avoid O(n^2) insertion into PartialSections

Alexandre Ganea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 3 16:46:31 PST 2019


aganea accepted this revision.
aganea added a comment.
This revision is now accepted and ready to land.

Thanks for fixing this Martin. My mistake, I was annoyed by the fact that the key was sharing its data with the value, went to change the `std::map` into a `std::set`, then I machinally changed the search to `find_if`.
Is there any way to subsequently add a stress test for this? (ie. the test would fail if `lld-link` takes >5 sec)



================
Comment at: COFF/Writer.cpp:1778
+  PartialSectionKey Key = {Name, OutChars};
+  PartialSection *&PSec = PartialSections[Key];
   if (PSec)
----------------
What about `PartialSection *&PSec = PartialSections[{Name, OutChars}];` ?


================
Comment at: COFF/Writer.cpp:1787
+  PartialSectionKey Key = {Name, OutChars};
+  return PartialSections[Key];
 }
----------------
`return PartialSections[{Name, OutChars}];` ?


Repository:
  rLLD LLVM Linker

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57666/new/

https://reviews.llvm.org/D57666





More information about the llvm-commits mailing list