Optimize org.apache.pivot.wtk.text.TextNode
-------------------------------------------
Key: PIVOT-550
URL: https://issues.apache.org/jira/browse/PIVOT-550
Project: Pivot
Issue Type: Improvement
Components: wtk
Reporter: Greg Brown
Priority: Minor
Fix For: 2.0
Currently, this class uses a StringBuilder internally to manage text updates.
While this is efficient for constructing strings, TextNode is not as efficient
at handling strings that are not being modified: TextNode#getText() calls
toString() on the internal StringBuilder, which generates a new String instance
each time it is called. Since paint operations (which call getText()) are
likely to occur more often than changes to the text, this is most likely
producing a number of unnecessary heap allocations.
TextInput was recently updated to use a StringBuilder to construct new Strings
when changes are made, but it uses a String instance internally to store the
text property value. A similar approach could be taken in TextNode.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.