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

Dynalink constants can be shorter

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Duplicate
    • P4
    • None
    • 9
    • core-libs
    • None

    Description

      If you run Nashorn/Octane benchmarks with a simple instrumentation that prints out the symbols looked up from VM's Symbol table...

      ~/trunks/jdk9-dev/build/linux-x86_64-normal-server-release/images/j2sdk-image/bin/java -jar ~/trunks/jdk9-dev/build/linux-x86_64-normal-server-release/images/j2sdk-image/jre/lib/ext/nashorn.jar -Dnashorn.typeInfo.disabled=false --class-cache-size=0 --persistent-code-cache=false -scripting --log=time test/script/basic/run-octane.js -- --iterations 1

      Then you will get the output like this:
       http://cr.openjdk.java.net/~shade/8059399/all-symbols.log.gz

      Sifting through this output yields an interesting observation (the log is sorted and uniq-qed):

      $ zcat all-symbols.log.gz | wc
      60051 63459 3515831

      $ zcat all-symbols.log.gz | grep dyn: | wc
      9190 9190 345292

      That is, around 10% of all symbol space is consumed by "dyn:..." constants, and the average length of "dyn:..." constant is around 37 characters. The look of these constants reveals an interesting structure: "dyn:setProp|setElem:xrefstms". It seems profitable to condense the control prefixes of these constants to something more dense, e.g. "D:P|E:xrefstms", which will save ~14 bytes per constant. This adds up to ~128K characters saved in metaspace memory in Nashorn/Octane case. Careful redesign may also improve constant parsing time, and therefore contribute to better warmup.

      Attachments

        Issue Links

          Activity

            People

              attila Attila Szegedi
              shade Aleksey Shipilev
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: