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

Zachary Turner via lldb-commits lldb-commits at lists.llvm.org
Wed Apr 26 11:06:08 PDT 2017


Other alternatives though include adding a function to StringMap which
gives us what we need, and having this function do the pointer hacking, or
simply calling strlen.

On Wed, Apr 26, 2017 at 11:03 AM Scott Smith via Phabricator <
reviews at reviews.llvm.org> wrote:

> 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
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20170426/d2b078e2/attachment-0001.html>


More information about the lldb-commits mailing list