[PATCH] D109632: [clang] de-duplicate methods from AST files

Richard Howell via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 10 15:14:52 PDT 2021


rmaz added inline comments.


================
Comment at: clang/lib/Serialization/ASTReader.cpp:8194
+    if (seen.insert(M).second) {
+      S.addMethodToGlobalList(&List, M);
+    }
----------------
manmanren wrote:
> Does it make sense to check for duplication inside addMethodToGlobalList, as the function goes through the list as well? Maybe it is slower, as we will need to go through the list for each method, instead of a lookup.
Yes, you are right, it is slower as we need to do a list traverse per insert rather than per selector lookup. I also profiled keeping some global state along with the `MethodPool` so that the set didn't have to be rebuilt each time, but the performance difference was negligible.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109632



More information about the cfe-commits mailing list