ChuanqiXu marked 2 inline comments as done.
ChuanqiXu added inline comments.


================
Comment at: clang/lib/AST/ASTContext.cpp:6232
+
+  auto getHashValueForPrimaryModule = [this](const Module *M) {
+    if (!PrimaryModuleHash.count(M))
----------------
erichkeane wrote:
> Doesn't `FindAndConstruct` do something pretty similar here?  This lambda is 
> incredibly inefficient as it requires two 3 separate lookups into the map.
> 
> Instead, I believe `FindAndConstruct` will create a new entry (which can be 
> 'set' if necessary', and then have its value returned.
On the one hand, `FindAndConstruct ` would construct an empty value, which is 
not we want. We want the value to be a hash_value of the name. On the other 
hand, your comments makes sense the implementation could be optimized. 
Currently, there would be at most 2 lookups and the number should be 1 at the 
hot path.


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

https://reviews.llvm.org/D130864

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to