You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Joel Richard (JIRA)" <ji...@apache.org> on 2015/10/07 17:40:27 UTC

[jira] [Created] (SLING-5117) Reuse PrintWriter to avoid initialisation overhead

Joel Richard created SLING-5117:
-----------------------------------

             Summary: Reuse PrintWriter to avoid initialisation overhead
                 Key: SLING-5117
                 URL: https://issues.apache.org/jira/browse/SLING-5117
             Project: Sling
          Issue Type: Improvement
          Components: Scripting
            Reporter: Joel Richard
            Priority: Minor


Surprisingly, java.io.PrintWriter is relatively expensive to initialise because of the AccessController.doPrivileged call in the constructor. Right now, it initialises for each include a new PrintWriter which costs 2-3% rendering time.

In order to avoid this overhead, I would suggest to fix SLING-1284 properly (as far as I have seen there is a real fix in Tomcat) and create a reusable PrintWriter in PageContextImpl together with the JspWriter. In addition, the OnDemandWriterResponse must be adjusted to not create a new PrintWriter. Maybe, all the OnDemand* classes could also just be removed.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)