[ https://issues.apache.org/jira/browse/LANG-1248?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15363916#comment-15363916 ]
ASF GitHub Bot commented on LANG-1248:
--------------------------------------
GitHub user benbenw opened a pull request:
https://github.com/apache/commons-lang/pull/169
LANG-1248 FastDatePrinter Memory allocation regression
When the code was migrated from StringBuffer to Appendable in LANG-1152.
We've lost the ability to modify the buffer (setCharAt)
The new implementation of appendFullDigits allocate a temporary char
array to work around that limitation.
This is a major source of memory allocation which is not present in
version 3.4.
Test case :
Single fastdateformat instance
100000 format of long
pattern : yyyy-MM-dd'T'HH:mm:ss.SSSZ
lang 3.4 : ~30 MB allocated
lang 3.5-snapshot : ~40 MB allocated
-> ~9.3 MB are coming from appendFullDigits called from
PaddedNumberField
This commit add a fast path for 1 to 4 digits which avoid the memory
allocation from the temporary work array.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/benbenw/commons-lang LANG-1248
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/commons-lang/pull/169.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #169
----
commit d201ad32af1e71140539fbd7efe701f6b2e89ffe
Author: benoit
Date: 2016-07-06T07:14:08Z
LANG-1248 FastDatePrinter Memory allocation regression
When the code was migrated from StringBuffer to Appendable in LANG-1152.
We've lost the ability to modify the buffer (setCharAt)
The new implementation of appendFullDigits allocate a temporary char
array to work around that limitation.
This is a major source of memory allocation which is not present in
version 3.4.
Test case :
Single fastdateformat instance
100000 format of long
pattern : yyyy-MM-dd'T'HH:mm:ss.SSSZ
lang 3.4 : ~30 MB allocated
lang 3.5-snapshot : ~40 MB allocated
-> ~9.3 MB are coming from appendFullDigits called from
PaddedNumberField
This commit add a fast path for 1 to 4 digits which avoid the memory
allocation from the temporary work array.
----
> FastDatePrinter Memory allocation regression
> --------------------------------------------
>
> Key: LANG-1248
> URL: https://issues.apache.org/jira/browse/LANG-1248
> Project: Commons Lang
> Issue Type: Bug
> Components: lang.time.*
> Affects Versions: 3.5
> Reporter: Benoit Wiart
>
> when the code was migrated from StringBuffer to Appendable in LANG-1152.
> We've lost the ability to modify the buffer (setCharAt)
> The new implementation of appendFullDigits allocate a temporary char array to work around that limitation.
> This is a major source of memory allocation which is not present in version 3.4.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)