[richfaces-issues] [JBoss JIRA] (RF-12652) Improve ScriptUtils performance by doing early preallocation in String encode path
Darius Ski (JIRA)
jira-events at lists.jboss.org
Mon Dec 10 16:48:17 EST 2012
[ https://issues.jboss.org/browse/RF-12652?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Darius Ski updated RF-12652:
----------------------------
Description:
In ScriptUtils.toScript(Object obj) method there is allocation of StringBuilder with default size (of 16 characters). When large sized strings are passed to this method ( for example in partial rendering user bean returns a String with custom JSON ), method incurs penalty due to reallocations ( both in GC pressure and CPU use).
The preallocation size could be set to 1.6-2 of initial size, cause we know that String is getting escaped and inflated by both normal (*2) and unicode escapes ( \u00XX style * 6).
was:
In ScriptUtils.toScript(Object obj) method there is allocation of StringBuilder with default size (of 16bytes). When large sized strings are passed to this method ( for example in partial rendering user bean returns a String with custom JSON ), method incurs penalty due to reallocations ( both in GC pressure and CPU use).
The preallocation size could be set to 1.6-2 of initial size, cause we know that String is getting escaped and inflated by both normal (*2) and unicode escapes ( \u00XX style * 6).
> Improve ScriptUtils performance by doing early preallocation in String encode path
> ----------------------------------------------------------------------------------
>
> Key: RF-12652
> URL: https://issues.jboss.org/browse/RF-12652
> Project: RichFaces
> Issue Type: Enhancement
> Security Level: Public(Everyone can see)
> Components: core
> Affects Versions: 4.3.0.M2
> Reporter: Darius Ski
> Priority: Minor
>
> In ScriptUtils.toScript(Object obj) method there is allocation of StringBuilder with default size (of 16 characters). When large sized strings are passed to this method ( for example in partial rendering user bean returns a String with custom JSON ), method incurs penalty due to reallocations ( both in GC pressure and CPU use).
> The preallocation size could be set to 1.6-2 of initial size, cause we know that String is getting escaped and inflated by both normal (*2) and unicode escapes ( \u00XX style * 6).
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the richfaces-issues
mailing list