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

performance optimization: introduce a weak hash of loaded images

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Won't Fix
    • Icon: P4 P4
    • fx2.0
    • fx1.0.1
    • javafx

      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.

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

              Created:
              Updated:
              Resolved:
              Imported: