[PATCH] D69295: Optimize SHA1 implementation

Nick Terrell via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 22 13:07:59 PDT 2019


terrelln marked an inline comment as done.
terrelln added a comment.

> If you really want to make this fast, I think Intel processors have special-purpose instructions to accelerate SHA1 computation. Have you consider using them?

Yeah, I don't think this is the fastest it could be. Switching to XXH or MD5 speeds up LLD by another ~3%, and each of those is IO bound. So there is a little bit left to gain in the SHA1 implementation for LLD before it is completely IO bound. And in use cases that are operating on hot memory (in L3 at least) there is a lot more to gain. But... this gets most of the benefit for LLD for a little work.

Someone could certainly take this further and add an implementation using SIMD or hardware intrinsics.



================
Comment at: llvm/unittests/Support/raw_sha1_ostream_test.cpp:55
+  // Long update that gets into the optimized loop with prefix/suffix.
+  sha1.update(Input + Input + Input + Input);
+  // 18 bytes buffered now.
----------------
Yup, right here


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69295





More information about the llvm-commits mailing list