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

AbstractScriptEngine.getScriptContext creation of SimpleScriptContext is inefficient

XMLWordPrintable

    • b11
    • generic
    • generic

      FULL PRODUCT VERSION :


      A DESCRIPTION OF THE PROBLEM :
      Every time the method getScriptContext is called, a new instance of SimpleScriptContext is created. This calls
              reader = new InputStreamReader(System.in);
              writer = new PrintWriter(System.out , true);
              errorWriter = new PrintWriter(System.err, true);
      immediately to be replaced by
              ctxt.setReader(context.getReader());
              ctxt.setWriter(context.getWriter());
              ctxt.setErrorWriter(context.getErrorWriter());
      The creation of the reader and writers causes significant overhead in the sense that these objects need to be immediately garbage collected again.
      When this method is called a lot, a new Constructor for SimpleScriptContext that allows the passing of the reader and writers would be a lot more efficient.


      REPRODUCIBILITY :
      This bug can be reproduced always.

            hannesw Hannes Wallnoefer
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: