You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Radu Cotescu (Jira)" <ji...@apache.org> on 2025/01/23 13:04:00 UTC

[jira] [Created] (SLING-12635) JS Use Scripts should only be read on-demand

Radu Cotescu created SLING-12635:
------------------------------------

             Summary: JS Use Scripts should only be read on-demand
                 Key: SLING-12635
                 URL: https://issues.apache.org/jira/browse/SLING-12635
             Project: Sling
          Issue Type: Bug
          Components: Scripting
            Reporter: Radu Cotescu
            Assignee: Radu Cotescu


When SLING-9320 was implemented [0], the {{DependencyResolver}} was extended to provide a {{ScriptNameAwareReader}}. This functionality was moved over from the {{JsEnvironment}} but slightly rewritten to use a {{StringReader}} instead of an {{InputStreamReader}}. This introduced a performance penalty, since JS scripts are now completely read all the time, instead of being read only when they need to be compiled/evaluated.

The code should be switched back to use an {{InputStreamReader}}, so that the scripts are read on-demand when they must be compiled/evaluated.

[0] - https://github.com/apache/sling-org-apache-sling-scripting-sightly-js-provider/commit/6ebafff6d81367a3b7fb2ab942795f7a73972668#diff-cd9e9b522cd2455e47baa78c2bb6c701894b2064bf9882ecd81cd3af285396d9



--
This message was sent by Atlassian Jira
(v8.20.10#820010)