Skip to content

Commit 24a7585

Browse files
committed
Update release notes, minor naming wrt #220
1 parent b0a292e commit 24a7585

File tree

3 files changed

+21
-14
lines changed

3 files changed

+21
-14
lines changed

release-notes/CREDITS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,3 +116,8 @@ Philipp Nanz (@philippn)
116116
(7.1.0)
117117
* Contributed #211: Disable `resolveEntityReferences` by default for newly created SAX parsers
118118
(7.1.0)
119+
120+
Winfried Gerlach (@winfriedgerlach)
121+
122+
* Contributed #220: Switch to lookup tables in hotspots `isNameChar()`/`isNameStartChar()`
123+
(7.1.1)

release-notes/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Project: woodstox
99
#213: SAX: `Locator#getSystemId` and `Locator#getPublicId` are not
1010
available during `startDocument` event
1111
(fix contributed by Philipp N)
12-
#221: Switch to lookup tables in hotspots `isNameChar()`/`isNameStartChar()`
12+
#220: Switch to lookup tables in hotspots `isNameChar()`/`isNameStartChar()`
1313
(contributed by @winfriedgerlach)
1414

1515
7.1.0 (22-Oct-2024)

src/main/java/com/ctc/wstx/io/WstxInputData.java

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,21 +52,23 @@ public class WstxInputData
5252
*/
5353
public final static int MAX_UNICODE_CHAR = 0x10FFFF;
5454

55-
private static final boolean[] asciiNameStartChars = new boolean[128];
55+
// @since 7.1.1
56+
private static final boolean[] ASCII_NAME_START_CHARS = new boolean[128];
5657
static {
57-
IntStream.rangeClosed('a', 'z').forEach(i -> asciiNameStartChars[i] = true);
58-
IntStream.rangeClosed('A', 'Z').forEach(i -> asciiNameStartChars[i] = true);
59-
asciiNameStartChars['_'] = true;
58+
IntStream.rangeClosed('a', 'z').forEach(i -> ASCII_NAME_START_CHARS[i] = true);
59+
IntStream.rangeClosed('A', 'Z').forEach(i -> ASCII_NAME_START_CHARS[i] = true);
60+
ASCII_NAME_START_CHARS['_'] = true;
6061
}
6162

62-
private static final boolean[] asciiNameChars = new boolean[128];
63+
// @since 7.1.1
64+
private static final boolean[] ASCII_NAME_CHARS = new boolean[128];
6365
static {
64-
IntStream.rangeClosed('a', 'z').forEach(i -> asciiNameChars[i] = true);
65-
IntStream.rangeClosed('A', 'Z').forEach(i -> asciiNameChars[i] = true);
66-
IntStream.rangeClosed('0', '9').forEach(i -> asciiNameChars[i] = true);
67-
asciiNameChars['.'] = true;
68-
asciiNameChars['-'] = true;
69-
asciiNameChars['_'] = true;
66+
IntStream.rangeClosed('a', 'z').forEach(i -> ASCII_NAME_CHARS[i] = true);
67+
IntStream.rangeClosed('A', 'Z').forEach(i -> ASCII_NAME_CHARS[i] = true);
68+
IntStream.rangeClosed('0', '9').forEach(i -> ASCII_NAME_CHARS[i] = true);
69+
ASCII_NAME_CHARS['.'] = true;
70+
ASCII_NAME_CHARS['-'] = true;
71+
ASCII_NAME_CHARS['_'] = true;
7072
}
7173

7274
/*
@@ -174,7 +176,7 @@ protected final boolean isNameStartChar(char c)
174176
*/
175177
if (c < 128) {
176178
// this is performance critical, so we use a lookup table instead of if-branches
177-
return asciiNameStartChars[c];
179+
return ASCII_NAME_START_CHARS[c];
178180
}
179181
/* Ok, otherwise need to use a big honking bit sets... which
180182
* differ between 1.0 and 1.1
@@ -194,7 +196,7 @@ protected final boolean isNameChar(char c)
194196
// First, let's handle 7-bit ascii range
195197
if (c < 128) {
196198
// this is performance critical, so we use a lookup table instead of if-branches
197-
return asciiNameChars[c];
199+
return ASCII_NAME_CHARS[c];
198200
}
199201
return mXml11 ? XmlChars.is11NameChar(c) : XmlChars.is10NameChar(c);
200202
}

0 commit comments

Comments
 (0)