[all-commits] [llvm/llvm-project] 67c631: [ADT][StringMap] Add ability to precompute and reu...
David Blaikie via All-commits
all-commits at lists.llvm.org
Mon Dec 11 16:07:25 PST 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 67c631d283fc96d652304199cd625be426b98f8e
https://github.com/llvm/llvm-project/commit/67c631d283fc96d652304199cd625be426b98f8e
Author: David Blaikie <dblaikie at gmail.com>
Date: 2023-12-12 (Tue, 12 Dec 2023)
Changed paths:
M llvm/include/llvm/ADT/StringMap.h
M llvm/lib/Support/StringMap.cpp
M llvm/unittests/ADT/StringMapTest.cpp
Log Message:
-----------
[ADT][StringMap] Add ability to precompute and reuse the string hash
Useful for lldb's const string pool, using the hash to determine which
string map to lock and query/insert.
Derived from https://reviews.llvm.org/D122974 by Luboš Luňák
Commit: 2e197602305be18b963928e6ae024a004a95af6d
https://github.com/llvm/llvm-project/commit/2e197602305be18b963928e6ae024a004a95af6d
Author: David Blaikie <dblaikie at gmail.com>
Date: 2023-12-12 (Tue, 12 Dec 2023)
Changed paths:
M lldb/source/Utility/ConstString.cpp
Log Message:
-----------
lldb: Cache string hash during ConstString pool queries/insertions
lldb was rehashing the string 3 times (once to determine which StringMap
to use, once to query the StringMap, once to insert) on insertion (twice
on successful lookup).
This patch allows the lldb to benefit from hash improvements in LLVM
(from djbHash to xxh3).
Though further changes would be needed to cache this value to disk - we
shouldn't rely on the StringMap::hash remaining the same in the
future/this value should not be serialized to disk. If we want cache
this value StringMap should take a hashing template parameter to allow
for a fixed hash to be requested.
Compare: https://github.com/llvm/llvm-project/compare/95d6aa21fbd4...2e197602305b
More information about the All-commits
mailing list