[Lldb-commits] [PATCH] D32306: Remove lock from ConstString::GetLength

Scott Smith via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Apr 26 11:03:28 PDT 2017


scott.smith added inline comments.


================
Comment at: source/Utility/ConstString.cpp:49
+      // pointer, we don't need the lock.
       const StringPoolEntryType &entry = GetStringMapEntryFromKeyData(ccstr);
       return entry.getKey().size();
----------------
zturner wrote:
> Why do we even have this function which digs into the `StringMap` internals rather than just calling existing `StringMap` member functions?  Can Can we just delete `GetStringMapEntryFromKeyData` entirely and use `StringMap::find`?
Probably performance.  If we have to call Find, then we have to call hash, fault in the appropriate bucket, and then finally return the entry that we already have in hand.  Plus we'd need the lock.



Repository:
  rL LLVM

https://reviews.llvm.org/D32306





More information about the lldb-commits mailing list