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

Use modifiable BitSet in change listeners in CSS code

XMLWordPrintable

      ...because it is much faster to just pass around the original BitSet and it looks like there is no way for application code to get to the data.

      This diff gets us a 20% speedup on the TableViewTest benchmark on the Raspberry Pi using default parameters:

      --- a/javafx-ui-common/src/com/sun/javafx/css/BitSet.java Mon May 06 15:11:35 2013 -0400
      +++ b/javafx-ui-common/src/com/sun/javafx/css/BitSet.java Thu May 09 00:09:20 2013 +0300
      @@ -549,7 +549,7 @@
               private final boolean removed;
       
               public Change(T element, boolean removed) {
      - super(FXCollections.unmodifiableObservableSet(BitSet.this));
      + super(BitSet.this);
                   this.element = element;
                   this.removed = removed;
               }

      If you run this on the desktop you can see with profiling tools that this saves a very large number of allocations of SetChangeAdapter objects. This accounts for the performance improvement on embedded platforms.

      Is this change safe?

            dgrieve David Grieve
            dblaukop Daniel Blaukopf (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: