JDK-8120155 : CSS: refactor calculated value cache to avoid multiple hashtable gets and un-necessary value calculations
  • Type: Bug
  • Component: javafx
  • Sub-Component: controls
  • Affected Version: 8
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2013-06-04
  • Updated: 2015-06-17
  • Resolved: 2013-06-13
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 8
8Fixed
Related Reports
Blocks :  
Description
Current implementation of cache for calculated values is that a CssStyleHelper gets a local cache. The local-cache is backed by the shared-cache. When a property is looked up from the cache, the value is fetched from the local-cache. If it isn't found, then the value is looked up in the shared-cache.

The second issue is that we have to calculate values just to know whether or not an already calculated value can be used. 

The reason there is a local cache is in case a style is calculated from an inline style. Using in-line styles is evil and overall css performance suffers (in part) because of trying to work around in-line styles. It would be much simpler if a CssStyleHelper could just do simple gets and puts on the cache and not worry about whether the value is calculated from an in-line style or not. 

The idea is to use only a shared cache, but the shared cache is created for the root node and for any node with an in-line style. So if there are no inline-styles, there is one shared cache (per StyleCache). If I have an inline style on my button, then that button gets a new cache and will have to calculate all its values.

Any child of a node with an inline style would also get its own cache. This will be a memory hit. 
Comments
http://hg.openjdk.java.net/openjfx/8/controls/rt/rev/1fbbc9191ba0
13-06-2013

checkbox benchmark went from 84.6 FPS to 103.4 FPS running full speed on Mac. Roughly 22% improvement. Looks promising.
04-06-2013