[ 
https://issues.apache.org/jira/browse/SLING-2787?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Carsten Ziegeler resolved SLING-2787.
-------------------------------------

    Resolution: Fixed

Thanks for your patch, Lukas - I've applied it.

While I agree that this is a non-issue in real-world scenarios, the change is 
pretty simple and straight forward.
                
> Inefficient array conversion in ValueMapDecorator.convertToArray()
> ------------------------------------------------------------------
>
>                 Key: SLING-2787
>                 URL: https://issues.apache.org/jira/browse/SLING-2787
>             Project: Sling
>          Issue Type: Bug
>          Components: API
>    Affects Versions: API 2.3.0
>            Reporter: Lukas Eder
>            Assignee: Carsten Ziegeler
>            Priority: Minor
>             Fix For: API 2.4.0
>
>         Attachments: ValueMapDecorator.java.patch, ValueMapTest.java
>
>
> The method ValueMapDecorator.convertToArray() seems to have a rather 
> canonical implementation, which can be improved significantly. The roundtrip 
> via a temporary LinkedList seems unnecessary and leads to a significant 
> performance loss in "high throughput" test scenarios. Attached, you'll find a 
> test case leading to the below results:
> Run with 10000000 repetitions.
> String[] -> Integer[]: 1464.146 ms
> String   -> Integer[]: 826.171 ms
> After applying the attached patch, the results improve significantly:
> Run with 10000000 repetitions.
> String[] -> Integer[]: 1010.143 ms
> String   -> Integer[]: 524.219 ms
> While the effect of the improvement is less significant in a "real-world" 
> scenario, I still think it is worth improving this central API class

--
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

Reply via email to