[Lldb-commits] [lldb] 9a6a0df - [lldb] make ConstStringTable use DenseMap rather than std::map

Luboš Luňák via lldb-commits lldb-commits at lists.llvm.org
Mon Apr 4 09:47:21 PDT 2022


Author: Luboš Luňák
Date: 2022-04-04T18:46:22+02:00
New Revision: 9a6a0dfa06a5acd01f6b55f8a1ba9f0f5109e02c

URL: https://github.com/llvm/llvm-project/commit/9a6a0dfa06a5acd01f6b55f8a1ba9f0f5109e02c
DIFF: https://github.com/llvm/llvm-project/commit/9a6a0dfa06a5acd01f6b55f8a1ba9f0f5109e02c.diff

LOG: [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

Added: 
    

Modified: 
    lldb/include/lldb/Core/DataFileCache.h

Removed: 
    


################################################################################
diff  --git a/lldb/include/lldb/Core/DataFileCache.h b/lldb/include/lldb/Core/DataFileCache.h
index 3016c531f6746..6f7de679f8679 100644
--- a/lldb/include/lldb/Core/DataFileCache.h
+++ b/lldb/include/lldb/Core/DataFileCache.h
@@ -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 @@ class ConstStringTable {
 
 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;
 };


        


More information about the lldb-commits mailing list