ChuanqiXu9 wrote:

Thanks for the profiling data. It narrows the scope a lot. But it makes me 
confusing too. Since the scope is pretty narrow, we can do an analysis here: 
https://github.com/llvm/llvm-project/blob/a7a1195f01037e5019f671c96ef4bca9af9bb9a7/clang/lib/Serialization/MultiOnDiskHashTable.h#L145-L173

In `clang::serialization::MultiOnDiskHashTable::condense()`, only 
https://github.com/llvm/llvm-project/blob/a7a1195f01037e5019f671c96ef4bca9af9bb9a7/clang/lib/Serialization/MultiOnDiskHashTable.h#L160
 and 
https://github.com/llvm/llvm-project/blob/a7a1195f01037e5019f671c96ef4bca9af9bb9a7/clang/lib/Serialization/MultiOnDiskHashTable.h#L163-L164
 should be affected by this patch. Where the change in 
https://github.com/llvm/llvm-project/blob/a7a1195f01037e5019f671c96ef4bca9af9bb9a7/clang/lib/Serialization/MultiOnDiskHashTable.h#L160
 should almost be constant since it reads the length.

And for 
https://github.com/llvm/llvm-project/blob/a7a1195f01037e5019f671c96ef4bca9af9bb9a7/clang/lib/Serialization/MultiOnDiskHashTable.h#L163-L164,
 its implementation is: 
https://github.com/llvm/llvm-project/blob/43bd7ae65af40ff3378d5a0395a058ba834ad8dd/clang/lib/Serialization/ASTReader.cpp#L1215-L1225

For `ASTReader::getGlobalDeclID()`, the implementation is 
https://github.com/llvm/llvm-project/blob/43bd7ae65af40ff3378d5a0395a058ba834ad8dd/clang/lib/Serialization/ASTReader.cpp#L7623-L7644,
 what is almost bit operation comparing to the previous state.

So it just looks like the reason is that we extend the DeclID from uint32_t to 
uint64_t and there are too many on-disk hash tables (not a blame). @alexfh 
could you try to profile on the statements level?

---

BTW, I feel we may read too many times in `MultiOnDiskHashTable `, maybe we can 
improve this.



https://github.com/llvm/llvm-project/pull/92083
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to