Skip to content

[lldb] Avoid repeated hash lookups (NFC) #112471

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

kazutakahirata
Copy link
Contributor

No description provided.

@llvmbot
Copy link
Member

llvmbot commented Oct 16, 2024

@llvm/pr-subscribers-lldb

Author: Kazu Hirata (kazutakahirata)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/112471.diff

1 Files Affected:

  • (modified) lldb/source/Core/Progress.cpp (+3-2)
diff --git a/lldb/source/Core/Progress.cpp b/lldb/source/Core/Progress.cpp
index 27774ce7a5521b..c9a556472c06b6 100644
--- a/lldb/source/Core/Progress.cpp
+++ b/lldb/source/Core/Progress.cpp
@@ -151,10 +151,11 @@ void ProgressManager::Decrement(const Progress::ProgressData &progress_data) {
   std::lock_guard<std::mutex> lock(m_entries_mutex);
   llvm::StringRef key = progress_data.title;
 
-  if (!m_entries.contains(key))
+  auto it = m_entries.find(key);
+  if (it == m_entries.end())
     return;
 
-  Entry &entry = m_entries[key];
+  Entry &entry = it->second;
   entry.refcount--;
 
   if (entry.refcount == 0) {

@kazutakahirata kazutakahirata merged commit 282ab2f into llvm:main Oct 16, 2024
9 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_001_repeated_hash_lldb branch October 16, 2024 06:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants