Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-3635

[Javascript] Optimization level for byte code generator in Rhino should be configurable

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • Scripting JavaScript 2.0.12
    • Scripting
    • None

    Description

      The Rhino Javascript engine allows you to choose the level of optimization for the generated byte code or it lets you select whether the scripts should be run in interpreted mode [0].

      Currently, there is no way to configure this. By default, Rhino compiles scripts into JVM classes using the optimization level 0.

      This option should be configurable, and the default value for this configuration should be "-1" - meaning run scripts in interpreted mode. Since we are not caching script compilation artifacts, the interpreted mode gives the best performance for short-running scripts.

      The attached patch implements this improvement by exposing a configuration entry in the Rhino Javascript engine factory component.

      [0] https://developer.mozilla.org/en-US/docs/Mozilla/Projects/Rhino/Optimization

      Attachments

        1. SLING-3635.diff
          6 kB
          Marius-Andrei Danila

        Activity

          People

            bdelacretaz Bertrand Delacretaz
            madnl Marius-Andrei Danila
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: