You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Paul Nicolucci (JIRA)" <de...@myfaces.apache.org> on 2018/08/06 19:38:00 UTC
[jira] [Reopened] (MYFACES-4244) [perf] Use StringBuilder rather
than calling write many times to increase performance
[ https://issues.apache.org/jira/browse/MYFACES-4244?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul Nicolucci reopened MYFACES-4244:
-------------------------------------
> [perf] Use StringBuilder rather than calling write many times to increase performance
> -------------------------------------------------------------------------------------
>
> Key: MYFACES-4244
> URL: https://issues.apache.org/jira/browse/MYFACES-4244
> Project: MyFaces Core
> Issue Type: Improvement
> Affects Versions: 2.2.12, 2.3.1
> Reporter: Paul Nicolucci
> Assignee: Paul Nicolucci
> Priority: Minor
>
> Using StringBuilder.append performs better than calling Writer.write multiple times because the path length for a StringBuffer.append is less than the path length of a Writer.write operation. By using StringBuilder, you only have to call the write method once instead of N number of times per method.
> The Shared StringBuilder may have some issues as well if there is any multi-threaded use of the Shared StringBuilder. If multiple threads could use a particular StringBuilder you would end up getting incorrect output. Another issue with the Shared StringBuilder for performance is it requires a call to get it which can be more expensive than just newing up a new StringBuilder.
> From looking at the myfaces code, the Shared StringBuilder is used only for special cases presently and not widely used.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)