[cfe-commits] r39059 - /cfe/cfe/trunk/Lex/Lexer.cpp
sabre at cs.uiuc.edu
sabre at cs.uiuc.edu
Wed Jul 11 09:27:12 PDT 2007
Author: sabre
Date: Wed Jul 11 11:27:12 2007
New Revision: 39059
URL: http://llvm.org/viewvc/llvm-project?rev=39059&view=rev
Log:
Speed up block comment skipping by 35%.
Modified:
cfe/cfe/trunk/Lex/Lexer.cpp
Modified: cfe/cfe/trunk/Lex/Lexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Lex/Lexer.cpp?rev=39059&r1=39058&r2=39059&view=diff
==============================================================================
--- cfe/cfe/trunk/Lex/Lexer.cpp (original)
+++ cfe/cfe/trunk/Lex/Lexer.cpp Wed Jul 11 11:27:12 2007
@@ -789,11 +789,31 @@
}
while (1) {
- // Skip over all non-interesting characters.
+ // Skip over all non-interesting characters until we find end of buffer or a
+ // (probably ending) '/' character.
// TODO: Vectorize this. Note: memchr on Darwin is slower than this loop.
+
+ 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;
+
+ while (CurPtr[0] != '/' &&
+ CurPtr[1] != '/' &&
+ CurPtr[2] != '/' &&
+ CurPtr[3] != '/' &&
+ CurPtr+4 < BufferEnd) {
+ CurPtr += 4;
+ }
+ C = *CurPtr++;
+ }
+
while (C != '/' && C != '\0')
C = *CurPtr++;
+ FoundSlash:
if (C == '/') {
if (CurPtr[-2] == '*') // We found the final */. We're done!
break;
More information about the cfe-commits
mailing list