You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by bu...@apache.org on 2002/08/19 20:47:02 UTC
DO NOT REPLY [Bug 11831] New: -
Extremely slow with long attribute values
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11831>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11831
Extremely slow with long attribute values
Summary: Extremely slow with long attribute values
Product: Xerces2-J
Version: 2.0.2
Platform: All
OS/Version: All
Status: NEW
Severity: Normal
Priority: Other
Component: Other
AssignedTo: xerces-j-dev@xml.apache.org
ReportedBy: ags@mimuw.edu.pl
Xerces requires a lot of time to parse long attribute values. It's caused by
XMLStringBuffer.java class. E.g. 130K file can be parsed for 20 seconds on
Pentium4.
Possible solution:
100c100
< // private char[] fOneCharBuffer = new char[1];
---
> private char[] fOneCharBuffer = new char[1];
162,164c162,163
< ensure(this.length + 1);
< this.ch[this.length] = c;
< ++this.length;
---
> fOneCharBuffer[0] = c;
> append(fOneCharBuffer, 0, 1);
167,182d165
< private int newSize(int length) {
< int l = this.ch.length;
< int r = length;
< while (r > l)
< l <<= 1;
< return l;
< }
<
< private void ensure(int length) {
< if (length > this.ch.length) {
< char[] newch = new char[newSize(length)];
< System.arraycopy(this.ch, 0, newch, 0, this.length);
< this.ch = newch;
< }
< }
<
190c173,177
< ensure(this.length + length);
---
> if (this.length + length > this.ch.length) {
> char[] newch = new char[this.ch.length + length + DEFAULT_SIZE];
> System.arraycopy(this.ch, 0, newch, 0, this.length);
> this.ch = newch;
> }
203c190,194
< ensure(this.length + length);
---
> if (this.length + length > this.ch.length) {
> char[] newch = new char[this.ch.length + length + DEFAULT_SIZE];
> System.arraycopy(this.ch, 0, newch, 0, this.length);
> this.ch = newch;
> }
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org