You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Benoit Wiart (JIRA)" <ji...@apache.org> on 2016/07/11 09:33:11 UTC

[jira] [Comment Edited] (LANG-1248) FastDatePrinter Memory allocation regression

    [ https://issues.apache.org/jira/browse/LANG-1248?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15370443#comment-15370443 ] 

Benoit Wiart edited comment on LANG-1248 at 7/11/16 9:32 AM:
-------------------------------------------------------------

I didn't do any memory measurement on the alternative implementation.
I did a JMH benchmark :
Benchmark                              Mode  Cnt   Score   Error  Units
MyBenchmark.testAppendFullDigits1      avgt  200  19,049 ± 0,215  ns/op
MyBenchmark.testAppendFullDigits2      avgt  200  27,371 ± 0,310  ns/op

Where 
testAppendFullDigits1 = initial patch (PR 169)
testAppendFullDigits2 = alternative implementation

the benchmark was for a value = 2016 and minFieldWidth = 3

So the initial patch is ugly BUT faster than the alternative implementation.


was (Author: benoitw):
I didn't do any memory measurement on the alternative implementation.
I did a JMH benchmark :
Benchmark                              Mode  Cnt   Score   Error  Units
MyBenchmark.testAppendFullDigits1      avgt  200  19,049 ± 0,215  ns/op
MyBenchmark.testAppendFullDigits2      avgt  200  27,371 ± 0,310  ns/op

Where 
testAppendFullDigits1 = initial patch (PR 169)
testAppendFullDigits2 = alternative implementation

So the initial patch is ugly BUT faster than the alternative implementation.

> 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
>            Assignee: Charles Honton
>
> 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)