The slow path (with at least one non US-ASCII) will be slower but that
doesn't matter.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
- Build Status
Buildable 31028 Build 31027: arc lint + arc unit
Event Timeline
Comment Actions
I measured 1.8x speedup on the corpus of readelf -s clang | awk '{print $8}' (purely US-ASCII)..
Comment Actions
Interesting. I take it the new code pipelines/unrolls better because it has a single branchless loop.
In terms of readability, I'd still try to split this into two functions, assuming that doesn't have a negative performance impact (which I'm hoping it doesn't). I'm thinking of something like
if (Optional<uint32_t> Result = fastCaseFoldingDjbHash(Buffer, H)) return *Result; // slow stuff...
Other than that, this looks good to me. Thanks for improving this.
Comment Actions
if (Optional<uint32_t> Result = fastCaseFoldingDjbHash(Buffer, H)) return *Result;
doesn't have a negative performance impact. Switched to that form.
llvm/trunk/lib/Support/DJB.cpp | ||
---|---|---|
61 ↗ | (On Diff #196832) | This should be AllASCII according to the LLVM style? |
llvm/trunk/lib/Support/DJB.cpp | ||
---|---|---|
61 ↗ | (On Diff #196832) | Fixed! |