CSV-279: Optimize Lexer Delimiter Check for One Character Delimiter (#163)

This commit is contained in:
belugabehr 2021-07-13 20:24:06 -04:00 committed by GitHub
parent cdbc8925d9
commit f7c067d9b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -123,6 +123,9 @@ final class Lexer implements Closeable {
if (ch != delimiter[0]) { if (ch != delimiter[0]) {
return false; return false;
} }
if (delimiter.length == 1) {
return true;
}
final int len = delimiter.length - 1; final int len = delimiter.length - 1;
final char[] buf = reader.lookAhead(len); final char[] buf = reader.lookAhead(len);
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {