diff options
| author | Sam McCall <sam.mccall@gmail.com> | 2019-07-08 11:33:17 +0000 |
|---|---|---|
| committer | Sam McCall <sam.mccall@gmail.com> | 2019-07-08 11:33:17 +0000 |
| commit | 674d8a947c7fc323dde9dc16d22667ce30169ee7 (patch) | |
| tree | 29fc013c8b5ac4507a0477f6c9a3f1e091a3defb /clang-tools-extra/clangd/index/Serialization.cpp | |
| parent | 556ec990e97c6e6bb6ef91d7bdb813b2776608f2 (diff) | |
| download | bcm5719-llvm-674d8a947c7fc323dde9dc16d22667ce30169ee7.tar.gz bcm5719-llvm-674d8a947c7fc323dde9dc16d22667ce30169ee7.zip | |
[clangd] Use xxhash instead of SHA1 for background index file digests.
Summary:
Currently SHA1 is about 10% of our CPU, this patch reduces it to ~1%.
xxhash is a well-defined (stable) non-cryptographic hash optimized for
fast checksums (like crc32).
Collisions shouldn't be a problem, despite the reduced length:
- for actual file content (used to invalidate bg index shards), there
are only two versions that can collide (new shard and old shard).
- for file paths in bg index shard filenames, we would need 2^32 files
with the same filename to expect a collision. Imperfect hashing may
reduce this a bit but it's well beyond what's plausible.
This will invalidate shards on disk (as usual; I bumped the version),
but this time the filenames are changing so the old files will stick
around :-( So this is more expensive than the usual bump, but would be
good to land before the v9 branch when everyone will start using bg index.
Reviewers: kadircet
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D64306
llvm-svn: 365311
Diffstat (limited to 'clang-tools-extra/clangd/index/Serialization.cpp')
| -rw-r--r-- | clang-tools-extra/clangd/index/Serialization.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang-tools-extra/clangd/index/Serialization.cpp b/clang-tools-extra/clangd/index/Serialization.cpp index 5b3c7cf943e..188a5cc1862 100644 --- a/clang-tools-extra/clangd/index/Serialization.cpp +++ b/clang-tools-extra/clangd/index/Serialization.cpp @@ -444,7 +444,7 @@ readCompileCommand(Reader CmdReader, llvm::ArrayRef<llvm::StringRef> Strings) { // The current versioning scheme is simple - non-current versions are rejected. // If you make a breaking change, bump this version number to invalidate stored // data. Later we may want to support some backward compatibility. -constexpr static uint32_t Version = 11; +constexpr static uint32_t Version = 12; llvm::Expected<IndexFileIn> readRIFF(llvm::StringRef Data) { auto RIFF = riff::readFile(Data); |

