JDK-8090461 : Insertion sort in OpenPisces ScanlineIterator may be very inefficient
  • Type: Enhancement
  • Component: javafx
  • Sub-Component: graphics
  • Affected Version: fx2.0
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2011-06-17
  • Updated: 2017-04-22
  • Resolved: 2017-04-19
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 10
10Fixed
Related Reports
Blocks :  
Blocks :  
Relates :  
Relates :  
Description
In ScanlineIterator.next() insertion sort is performed on an array consisting of almost sorted crossing points from previous edges (left part) and unsorted starting points of new edges (right part). In some very common cases (see linked issues), it just happens so that the right part is almost sorted in the reverse order thus making insertion sort very inefficient when the number of new edges is large (thousands). With rendering taking so long, application becomes totally unresponsive. 
Comments
This was fixed in JDK10 when we integrated the fix for JDK-8177985. For JDK9, there is a workaround which is to enable the Marlin rasterizer using "-Dprism.marlinrasterizer=true". I am marking this fixed in 10 as a result.
19-04-2017

MarlinFX was integrated in december 2016 (but MarlinFX is disabled by default in JFX9). MarlinFX fixes this performance issue.
19-04-2017

TextTest.java fixed for JavaFX8
14-10-2016

FYI the Marlin renderer (jdk9) use an optimized merge sort when the crossing number is important to fix such issue with text or very complex shapes. I ported this renderer it to JavaFX named Marlin-FX and the source code is available: https://github.com/bourgesl/marlin-fx I quickly reproduced that performance issue with JDK 1.8_b102 (open pisces) on my ubuntu 16.4: it becomes really slow !! Marlin-fx is very fast in comparison. How could I get the rendering time to improve the TextTest class (I fixed to make it work on JavaFX8) ?
14-10-2016

I have attached a simple test case for Text that shows the problem. Adding text quickly makes the application very sluggish - it takes ~10 seconds to render a frame with 2000-character text. If textNode.setStroke(Color.TRANSPARENT) is commented out, performance is as expected.
20-06-2011

If this ends up being worth doing, it should probably be addressed in OpenPisces itself, which we can pick up the next time we sync up.
17-06-2011