Minor performance improvement

Description

https://github.com/igniterealtime/Openfire/blob/master/src/java/org/jivesoftware/openfire/nio/XMLLightweightParser.java#384

Check for exact lengths of both strings instead of > 0. We have one additional length check but the string conversions happen only when the string length matches.

This change should be save, anyhow comments are welcome.

 

And as we know that the length of head will get ~16 bytes one could initialize it with at least 16 bytes to avoid that the JVM extends the buffer during runtime. Currently 5 bytes are used: "protected StringBuilder head = new StringBuilder(5);"

 

 

Environment

None

Activity

Show:
Fixed

Assignee

Reporter

Components

Fix versions

Affects versions

Priority

Created April 25, 2017 at 7:51 PM
Updated February 10, 2019 at 8:05 PM
Resolved February 10, 2019 at 8:05 PM