Skip to content

Performance Profile #411

@ghost

Description

Profile information from my application:

  • 4.3% + 1.5% of time is spent in com.sun.javafx.collections.VetoableListDecorator.add, which is called from org.fxmisc.richtext.ParagraphText.<init>.

ParagraphText

The following objects are instantiated for each paragraph, regardless of whether they get used:

    private final Path caretShape = new Path();
    private final Path selectionShape = new Path();
    private final List<Path> backgroundShapes = new ArrayList<>();
private final List<Path> underlineShapes = new ArrayList<>();

The selection shape, in particular, probably doesn't need to have an object assigned until needed. This implies that the following lines in the constructor might also be suitable for lazy initialization:

        // selection highlight
        selectionShape.setManaged(false);
        selectionShape.setFill(Color.DODGERBLUE);
        selectionShape.setStrokeWidth(0);
        selectionShape.layoutXProperty().bind(leftInset);
        selectionShape.layoutYProperty().bind(topInset);
getChildren().add(selectionShape);

TextExt

Another minor hot-spot in the application came from lines 113 to 125 of TextExt. If it is possible to cache the superclass' CSS meta data, rather than create a new list each time, it might offer a small performance boost.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions