[cfe-commits] [libcxx] r119611 - /libcxx/trunk/include/algorithm

Chris Lattner clattner at apple.com
Sat Nov 20 16:16:12 PST 2010


On Nov 20, 2010, at 3:57 PM, John McCall wrote:

>> 
>> I agree that it would make it easier to read/know.  On the other hand, /* */ comments have a nice vectorized comment skipper and // don't (and can't reasonably).  It probably isn't measurable, but this means that // comments are slower to lex than /* comments :-)
> 
> If you're really concerned about this, you *can* put BCPL comments inside C comments.  I, too, frequently find myself confused when looking at these headers because of the lengthy comments-than-don't-look-like-comments.

Yeah, but that also defeats the vectorized comment skipper:

   // Skip over all non-interesting characters until we find end of buffer or a
    // (probably ending) '/' character.
    if (CurPtr + 24 < BufferEnd) {
      // While not aligned to a 16-byte boundary.
      while (C != '/' && ((intptr_t)CurPtr & 0x0F) != 0)
        C = *CurPtr++;

      if (C == '/') goto FoundSlash;

#ifdef __SSE2__
      __m128i Slashes = _mm_set_epi8('/', '/', '/', '/', '/', '/', '/', '/',
                                     '/', '/', '/', '/', '/', '/', '/', '/');
      while (CurPtr+16 <= BufferEnd &&
             _mm_movemask_epi8(_mm_cmpeq_epi8(*(__m128i*)CurPtr, Slashes)) == 0)
        CurPtr += 16;
#elif __ALTIVEC__
...

-Chris



More information about the cfe-commits mailing list