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

CSS: refactor calculated value cache to avoid multiple hashtable gets and un-necessary value calculations

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 8
    • 8
    • javafx

      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.

            dgrieve David Grieve
            dgrieve David Grieve
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: