Uploaded image for project: 'Pivot'
  1. Pivot
  2. PIVOT-550

Optimize org.apache.pivot.wtk.text.TextNode

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0
    • Component/s: wtk
    • Labels:
      None

      Description

      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.

        Attachments

          Activity

            People

            • Assignee:
              grandinj Noel Grandin
              Reporter:
              gbrown Gregory K. Brown
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: