[PATCH] D33503: Make BinaryStreamReader::readCString a bit faster.

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Thu May 25 14:33:58 PDT 2017


Oops, yea I didn't see you comment on this one, figured it was too trivial
for you.  Anyway, yea that's a good idea, I'll submit it in a followup.

On Thu, May 25, 2017 at 2:32 PM Reid Kleckner via Phabricator <
reviews at reviews.llvm.org> wrote:

> rnk added a comment.
>
> Hm, did my comment not make it through?
>
>
>
> ================
> Comment at: llvm/lib/Support/BinaryStreamReader.cpp:52-54
> +    StringRef S(reinterpret_cast<const char *>(Buffer.begin()),
> Buffer.size());
> +    size_t Pos = S.find_first_of('\0');
> +    if (LLVM_LIKELY(Pos != StringRef::npos)) {
> ----------------
> How about `S = S.take_front(strnlen(S.data(), S.size()))`? There are some
> neat tricks for making strlen fast that don't work for memchr.
>
>
> Repository:
>   rL LLVM
>
> https://reviews.llvm.org/D33503
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170525/fc2079ba/attachment.html>


More information about the llvm-commits mailing list