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

CompiledScript slower when eval with binding

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 8u40
    • Fix Version/s: 9
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b13
    • CPU:
      generic
    • OS:
      generic

      Backports

        Description

        http://mail.openjdk.java.net/pipermail/nashorn-dev/2014-April/002920.html

        Dears

        I found if the script is evaled with binding, the execution time increased
        a lot.
        Do you know the reason?
        Check this

        String script_text = "var a = 1";

               ScriptEngineManager manager = new ScriptEngineManager();
               ScriptEngine engine = manager.getEngineByName("js");
               CompiledScript script = ((Compilable) engine).compile(script_text);

               Bindings bindings = engine.createBindings();

               long dt = new Date().getTime();
               for (int i = 0; i < 100000; i++) {
                   script.eval();
                   //script.eval(bindings); // switch to this line and feel the
        slow speed,
               }
               System.out.println(new Date().getTime() - dt);

        --
        Best wishes
             GAO

          Attachments

          1. Main1.java
            0.5 kB
          2. Main2.java
            0.9 kB

            Issue Links

              Activity

                People

                • Assignee:
                  sundar Sundararajan Athijegannathan
                  Reporter:
                  jlaskey Jim Laskey
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  4 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: