Skip to content

Commit

Permalink
FasterXML#220 do *not* use Arrays.copyOf(), performance seems to be i…
Browse files Browse the repository at this point in the history
…nferior to System.arrayCopy() + cleanup
  • Loading branch information
winfriedgerlach committed Nov 27, 2024
1 parent c72367f commit deb2507
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
1 change: 0 additions & 1 deletion src/main/java/com/ctc/wstx/sr/AttributeCollector.java
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,6 @@ public ElemAttrs buildAttrOb()
*/
int amapLen = mAttrMap.length;
int[] amap = new int[amapLen];
// TODO: JDK 1.6 has Arrays.copyOf(), should use with Woodstox 6
System.arraycopy(mAttrMap, 0, amap, 0, amapLen);
return new ElemAttrs(raw, mNonDefCount,
amap, mAttrHashSize, mAttrSpillEnd);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/ctc/wstx/sr/TypedStreamReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ public final int readElementAsArray(TypedArrayDecoder dec)
while (true) {
type = next();
if (type == END_ELEMENT) {
// Simple... no textul content
// Simple... no textual content
return -1;
}
if (type == COMMENT || type == PROCESSING_INSTRUCTION) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/ctc/wstx/util/StringVector.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.ctc.wstx.util;

/**
* Data container similar {@link java.util.List} (from storage perspective),
* Data container similar to {@link java.util.List} (from storage perspective),
* but that can be used in multiple ways. For some uses it acts more like
* type-safe String list/vector; for others as order associative list of
* String-to-String mappings.
Expand Down
10 changes: 5 additions & 5 deletions src/test/java/stax2/stream/TestReaderConstruction.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ public void testCreateWithByteArraySource()
byte[] b = orig.clone();
verifyXML(ifact.createXMLStreamReader(new Stax2ByteArraySource(b, 0, b.length)), "ByteArraySource");

// Also: let's check that non-0 offset works...
final int OFFSET = 29;
final int DOCLEN = b.length;
byte[] b2 = new byte[OFFSET + DOCLEN + 50];
System.arraycopy(b, 0, b2, OFFSET, DOCLEN);
// Also: let's check that non-0 offset works...
final int OFFSET = 29;
final int DOCLEN = b.length;
byte[] b2 = new byte[OFFSET + DOCLEN + 50];
System.arraycopy(b, 0, b2, OFFSET, DOCLEN);
verifyXML(ifact.createXMLStreamReader(new Stax2ByteArraySource(b2, OFFSET, DOCLEN)), "ByteArraySource");
}

Expand Down

0 comments on commit deb2507

Please sign in to comment.