<div dir="ltr">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.</div><br><div class="gmail_quote"><div dir="ltr">On Wed, Apr 26, 2017 at 11:03 AM Scott Smith via Phabricator <<a href="mailto:reviews@reviews.llvm.org">reviews@reviews.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">scott.smith added inline comments.<br>
<br>
<br>
================<br>
Comment at: source/Utility/ConstString.cpp:49<br>
+ // pointer, we don't need the lock.<br>
const StringPoolEntryType &entry = GetStringMapEntryFromKeyData(ccstr);<br>
return entry.getKey().size();<br>
----------------<br>
zturner wrote:<br>
> 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`?<br>
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.<br>
<br>
<br>
<br>
Repository:<br>
rL LLVM<br>
<br>
<a href="https://reviews.llvm.org/D32306" rel="noreferrer" target="_blank">https://reviews.llvm.org/D32306</a><br>
<br>
<br>
<br>
</blockquote></div>