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

performance optimization: introduce a weak hash of loaded images

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Won't Fix
    • Affects Version/s: fx1.0.1
    • Fix Version/s: fx2.0
    • Component/s: javafx
    • Labels:

      Description

      Demos like SmokeParticles may load the same image many many times, if they have code
      like this:
      public class Particle extends CustomNode {
          override function create(): Node {
              return ImageView {
                  transforms: [
                  Translate{ x : bind x, y : bind y } ]
                  image :
                      Image { url: "{__DIR__}resources/texture.png" }
                  opacity: bind timer / 100
              };
          }

        This is not an unusual pattern in FX.

        It means however that for every new particle we're forced to
        reload the image. This happens gazillion times per second.

        So, two solutions:
        1. fix the demo (for sure)
        2. introduce a weak hash of loaded resources in JavaFX so that
           we don't reload the same resource many times

      We may need to differentiate between images loaded with no scaling, and those with scaling.
      Caching those loaded w/o scaling is simpler.

        Attachments

          Activity

            People

            • Assignee:
              ckyang Chien Yang (Inactive)
              Reporter:
              tdv Dmitri Trembovetski (Inactive)
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported: