Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8355986

Optimize the creation/updating of RichParagraph in CodeArea

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • jfx24
    • javafx
    • generic
    • generic

      A DESCRIPTION OF THE PROBLEM :
      Currently, CodeArea updates RichParagraph using the SyntaxDecorator#createRichParagraph(CodeTextModel ctm, int i) method even when it's completely unnecessary.

      For example, consider a CodeArea with 1000 paragraphs and a visible area of 10 paragraphs. If the user modifies just one visible paragraph (e.g., by adding an 'A' character), CodeArea will recreate (via the createRichParagraph method) approximately 120-220 paragraphs depending on the modified paragraph's position. This seems excessive to me. After all, we're talking about a model - why create new paragraph instances every time when they haven't been modified?

      Therefore, I propose that the createRichParagraph method should only be called when absolutely necessary, such as:

      1. For initial paragraph creation
      2. For creating a new version of a paragraph when it has been modified by the user
      3. When code-generated events indicate paragraph changes, style modifications, etc.


            angorya Andy Goryachev
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: