Author: radu Date: Wed Oct 21 09:51:13 2015 New Revision: 1709781 URL: http://svn.apache.org/viewvc?rev=1709781&view=rev Log: SLING-5175 - The current set up of the ImporterTopLevel in the RhinoJavaScriptEngine incurs performance penalties
* configured the ImporterTopLevel for the rootScope provided by the RhinoJavaScriptEngineFactory Modified: sling/trunk/bundles/scripting/javascript/src/main/java/org/apache/sling/scripting/javascript/internal/RhinoJavaScriptEngine.java sling/trunk/bundles/scripting/javascript/src/main/java/org/apache/sling/scripting/javascript/internal/RhinoJavaScriptEngineFactory.java sling/trunk/bundles/scripting/sightly/testing/src/main/provisioning/model.txt Modified: sling/trunk/bundles/scripting/javascript/src/main/java/org/apache/sling/scripting/javascript/internal/RhinoJavaScriptEngine.java URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/javascript/src/main/java/org/apache/sling/scripting/javascript/internal/RhinoJavaScriptEngine.java?rev=1709781&r1=1709780&r2=1709781&view=diff ============================================================================== --- sling/trunk/bundles/scripting/javascript/src/main/java/org/apache/sling/scripting/javascript/internal/RhinoJavaScriptEngine.java (original) +++ sling/trunk/bundles/scripting/javascript/src/main/java/org/apache/sling/scripting/javascript/internal/RhinoJavaScriptEngine.java Wed Oct 21 09:51:13 2015 @@ -248,7 +248,7 @@ public class RhinoJavaScriptEngine exten } else { // create the request top scope, use the ImporterToplevel here // to support the importPackage and importClasses functions - scope = new ImporterTopLevel(rhinoContext); + scope = new ImporterTopLevel(); // Set the global scope to be our prototype scope.setPrototype(rootScope); Modified: sling/trunk/bundles/scripting/javascript/src/main/java/org/apache/sling/scripting/javascript/internal/RhinoJavaScriptEngineFactory.java URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/javascript/src/main/java/org/apache/sling/scripting/javascript/internal/RhinoJavaScriptEngineFactory.java?rev=1709781&r1=1709780&r2=1709781&view=diff ============================================================================== --- sling/trunk/bundles/scripting/javascript/src/main/java/org/apache/sling/scripting/javascript/internal/RhinoJavaScriptEngineFactory.java (original) +++ sling/trunk/bundles/scripting/javascript/src/main/java/org/apache/sling/scripting/javascript/internal/RhinoJavaScriptEngineFactory.java Wed Oct 21 09:51:13 2015 @@ -169,8 +169,8 @@ public class RhinoJavaScriptEngineFactor final Context rhinoContext = Context.enter(); try { - - Scriptable tmpScope = rhinoContext.initStandardObjects(new ImporterTopLevel(), false); + rhinoContext.setOptimizationLevel(optimizationLevel); + Scriptable tmpScope = rhinoContext.initStandardObjects(new ImporterTopLevel(rhinoContext), false); // default classes addHostObjects(tmpScope, (Class<? extends ScriptableObject>[]) HOSTOBJECT_CLASSES); Modified: sling/trunk/bundles/scripting/sightly/testing/src/main/provisioning/model.txt URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/sightly/testing/src/main/provisioning/model.txt?rev=1709781&r1=1709780&r2=1709781&view=diff ============================================================================== --- sling/trunk/bundles/scripting/sightly/testing/src/main/provisioning/model.txt (original) +++ sling/trunk/bundles/scripting/sightly/testing/src/main/provisioning/model.txt Wed Oct 21 09:51:13 2015 @@ -20,6 +20,7 @@ # Dependencies [artifacts] org.apache.sling/org.apache.sling.launchpad/8/slingstart + org.apache.sling/org.apache.sling.scripting.javascript/2.0.27-SNAPSHOT org.apache.sling/org.apache.sling.scripting.sightly/1.0.7-SNAPSHOT org.apache.sling/org.apache.sling.scripting.sightly.js.provider/1.0.11-SNAPSHOT org.apache.sling/org.apache.sling.scripting.sightly.models.provider/1.0.1-SNAPSHOT