This is an archive of the discontinued LLVM Phabricator instance.

[nfc] move expensive parts of Hashing.h into cpp file
Needs ReviewPublic

Authored by Trass3r on Nov 13 2022, 3:22 PM.

Details

Reviewers
hliao

Diff Detail

Event Timeline

Trass3r created this revision.Nov 13 2022, 3:22 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 13 2022, 3:22 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
Trass3r requested review of this revision.Nov 13 2022, 3:22 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 13 2022, 3:22 PM
Trass3r added inline comments.Nov 13 2022, 3:24 PM
llvm/include/llvm/ADT/Hashing.h
51

It'd be good to get rid of this completely since it shows up at the top of the expensive includes list but there's a non-trivial usage left below.

Trass3r updated this revision to Diff 475118.Nov 14 2022, 5:32 AM
Trass3r retitled this revision from move expensive parts of Hashing.h into cpp file to [nfc] move expensive parts of Hashing.h into cpp file.

rebase

Trass3r added inline comments.Nov 14 2022, 5:45 AM
llvm/include/llvm/ADT/Hashing.h
51

https://github.com/Trass3r/llvm-project/actions/runs/3458979320/jobs/5773908563#check-step-6

*** Expensive headers:
1461737 ms: lvm/include/llvm/ADT/Hashing.h (included 5485 times, avg 266 ms), included via:
1269781 ms: /usr/include/c++/11/algorithm (included 5535 times, avg 229 ms), included via:
987320 ms: /usr/include/c++/11/pstl/glue_algorithm_defs.h (included 5535 times, avg 178 ms), included via:
dblaikie added inline comments.
llvm/include/llvm/ADT/Hashing.h
51

Do you have stats on how much this patch changes those numbers?

Trass3r added inline comments.Dec 2 2022, 12:05 AM
llvm/include/llvm/ADT/Hashing.h
51

As mentioned since I couldn't remove the second rotate usage it doesn't change the top includes.
I'm pretty sure I only touched hash_state cause it showed up in the top class parsing costs but now the impact is smaller. Maybe I looked at the numbers only for LLVMSupport back then.

dblaikie added inline comments.Dec 2 2022, 1:46 PM
llvm/include/llvm/ADT/Hashing.h
51

Do you think this change is still worth doing?

RKSimon added a subscriber: RKSimon.Dec 2 2022, 1:56 PM
Trass3r added inline comments.Dec 8 2022, 2:49 AM
llvm/include/llvm/ADT/Hashing.h
51

I guess the question is more generally whether these non-templated functions were implemented in the header for some good reason (performance etc) or it simply grew over time.

dblaikie added inline comments.Dec 8 2022, 12:25 PM
llvm/include/llvm/ADT/Hashing.h
51

Probably important that these functions get inlined - but we have ThinLTO and such these days for anyone building Clang for speed anyway. I don't have /super/ strong feelings.