[lldb] make ConstStringTable use DenseMap rather than std::map

The ordering is not needed, and DenseMap is faster. I can measure
time spent in the SaveToCache() calls reduced to ~40% during LLDB
startup (and the total startup cost reduced to ~70%).

Differential Revision: https://reviews.llvm.org/D122980
This commit is contained in:
Luboš Luňák 2022-04-02 17:06:24 +02:00
parent 750bf3582a
commit 9a6a0dfa06
1 changed files with 2 additions and 1 deletions

View File

@ -13,6 +13,7 @@
#include "lldb/Utility/Status.h"
#include "lldb/Utility/UUID.h"
#include "lldb/lldb-forward.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/Support/Caching.h"
#include <mutex>
@ -190,7 +191,7 @@ public:
private:
std::vector<ConstString> m_strings;
std::map<ConstString, uint32_t> m_string_to_offset;
llvm::DenseMap<ConstString, uint32_t> m_string_to_offset;
/// Skip one byte to start the string table off with an empty string.
uint32_t m_next_offset = 1;
};