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

fx2.1-controls-scrum-b285: RT-19081 fix lead to 40% footprint regression in TableColumn

XMLWordPrintable

      The fix for "RT-19081: TableView shows resize cursor for columns that are not resizeable"
      integrated into fx2.1-controls-scrum-b285 results in 40% footprint regression in
      NodeMemory.TableColumn-rendering-on-64m. The footprint results are:
       b284: 1,430 objects
       b285: 860 objects

      Rollbacking RT-19081 changes in javafx-ui-controls/src/com/sun/javafx/scene/control/skin/NestedTableColumnHeader.java
      returns footprint results back. The diff is:

      > hg diff -r 157 -r 305 javafx-ui-controls/src/com/sun/javafx/scene/control/skin/NestedTableColumnHeader.java
      --- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/NestedTableColumnHeader.java Thu Dec 15 16:28:46 2011 +1000
      +++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/NestedTableColumnHeader.java Tue Jan 24 14:38:06 2012 +1300
      @@ -31,6 +31,8 @@
       import javafx.beans.InvalidationListener;
       import javafx.beans.Observable;
       import javafx.beans.WeakInvalidationListener;
      +import javafx.beans.binding.Bindings;
      +import javafx.beans.binding.ObjectBinding;
       import javafx.collections.ListChangeListener;
       import javafx.collections.ObservableList;
       import javafx.event.EventHandler;
      @@ -249,7 +251,13 @@
                   rect.setHeight(getHeight() - label.getHeight());
                   rect.setFill(Color.TRANSPARENT);
                   rect.setVisible(false);
      - rect.setCursor(Cursor.H_RESIZE);
      + rect.cursorProperty().bind(new ObjectBinding<Cursor>() {
      + { super.bind(c.resizableProperty()); }
      +
      + @Override protected Cursor computeValue() {
      + return c.isResizable() ? Cursor.H_RESIZE : Cursor.DEFAULT;
      + }
      + });
                   rect.setSmooth(false);
                   rect.setOnMousePressed(new EventHandler<MouseEvent>() {
                       @Override public void handle(MouseEvent me) {


      -------------

      Java heap memory analysis shows the following difference (with RT-19081 fix applied and without RT-19081 applied)
      in context of number of objects created:


      Number of TableColumns: 100
      Class Name | Objects | Shallow Heap
      -------------------------------------------------------------------------------------
      java.lang.ref.WeakReference | +5,599 | +134,376
      com.sun.javafx.binding.BindingHelperObserver | +5,600 | +89,600
      com.sun.javafx.binding.ExpressionHelper$SingleInvalidation | +106 | +1,696
      javafx.beans.property.ObjectPropertyBase$Listener | +106 | +1,696
      com.sun.javafx.scene.control.skin.NestedTableColumnHeader$7 | +106 | +1,696
      javafx.beans.InvalidationListener[] | +100 | +29,352
      javafx.beans.property.SimpleBooleanProperty | +100 | +3,200
      com.sun.javafx.binding.ExpressionHelper$MultipleInvalidation| +100 | +2,400
      -------------------------------------------------------------------------------------


      Number of TableColumns: 300
      Class Name | Objects | Shallow Heap
      -------------------------------------------------------------------------------------
      java.lang.ref.WeakReference | +49,800 | +1,195,200
      com.sun.javafx.binding.BindingHelperObserver | +49,800 | +796,800
      com.sun.javafx.binding.ExpressionHelper$SingleInvalidation | +306 | +4,896
      javafx.beans.property.ObjectPropertyBase$Listener | +306 | +4,896
      com.sun.javafx.scene.control.skin.NestedTableColumnHeader$7 | +306 | +4,896
      javafx.beans.InvalidationListener[] | +300 | +247,792
      javafx.beans.property.SimpleBooleanProperty | +300 | +9,600
      com.sun.javafx.binding.ExpressionHelper$MultipleInvalidation| +300 | +7,200
      -------------------------------------------------------------------------------------


      Number of TableColumns: 1,000
      Class Name | Objects | Shallow Heap
      --------------------------------------------------------------------------------------
      java.lang.ref.WeakReference | +505,926 | +12,142,224
      com.sun.javafx.binding.BindingHelperObserver | +506,000 | +8,096,000
      com.sun.javafx.binding.ExpressionHelper$SingleInvalidation | +1,006 | +16,096
      javafx.beans.property.ObjectPropertyBase$Listener | +1,006 | +16,096
      com.sun.javafx.scene.control.skin.NestedTableColumnHeader$7 | +1,006 | +16,096
      javafx.beans.InvalidationListener[] | +1,000 | +2,481,352
      javafx.beans.property.SimpleBooleanProperty | +1,000 | +32,000
      com.sun.javafx.binding.ExpressionHelper$MultipleInvalidation| +1,000 | +24,000
      --------------------------------------------------------------------------------------

      Perhaps this could be optimized.


      To run the test do:
      > java -client -Xms64m -Xmx64m -cp "rt/li/jfxrt.jar;./NodeMemory.jar"
        nodememory.TableColumnTest -render true -allocCnt 10 -sleep true

            jgiles Jonathan Giles
            epavlova Ekaterina Pavlova
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: