Skip to content

Commit

Permalink
Last improvement to JsonParserVisitor performance
Browse files Browse the repository at this point in the history
  • Loading branch information
knutwannheden committed Apr 15, 2024
1 parent 8e43096 commit 50d89ce
Showing 1 changed file with 13 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -332,20 +332,19 @@ private int positionOfNext(String untilDelim, @Nullable Character stop) {
inSingleLineComment = false;
}
} else {
if (source.length() - untilDelim.length() > delimIndex + 1) {
switch (source.substring(delimIndex, delimIndex + 2)) {
case "//":
inSingleLineComment = true;
delimIndex++;
break;
case "/*":
inMultiLineComment = true;
delimIndex++;
break;
case "*/":
inMultiLineComment = false;
delimIndex = delimIndex + 2;
break;
if (inMultiLineComment) {
if (source.charAt(delimIndex) == '*' && source.charAt(delimIndex + 1) == '/') {
inMultiLineComment = false;
delimIndex += 2;
}
} else if (source.charAt(delimIndex) == '/' && source.length() - untilDelim.length() > delimIndex + 1) {
int next = source.charAt(delimIndex + 1);
if (next == '/') {
inSingleLineComment = true;
delimIndex++;
} else if (next == '*') {
inMultiLineComment = true;
delimIndex++;
}
}

Expand Down

0 comments on commit 50d89ce

Please sign in to comment.