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

Nuno Santos resolved OAK-12413.
-------------------------------
    Fix Version/s: 2.8.0
       Resolution: Fixed

> Pre-size predictable ArrayList allocations in the compaction write path
> -----------------------------------------------------------------------
>
>                 Key: OAK-12413
>                 URL: https://issues.apache.org/jira/browse/OAK-12413
>             Project: Jackrabbit Oak
>          Issue Type: Improvement
>          Components: segment-tar
>            Reporter: Nuno Santos
>            Priority: Major
>             Fix For: 2.8.0
>
>
> Several {{ArrayList}}s allocated in {{DefaultSegmentWriter}}'s 
> write/compaction path (e.g. the map-entry list built from {{changes}}, the 
> leaf-bucket list built from map buckets, the property value-id list, and the 
> node/property id lists built while writing a node) start at the default 
> initial capacity and grow by repeated internal array reallocation and copy as 
> elements are added — even though their eventual size is already known at the 
> allocation site (e.g. {{changes.size()}}, {{newSize}}, {{state.count()}}, 
> {{template.getPropertyTemplates().length}}).
> Pre-size these lists using the already-available size hint ({{new 
> ArrayList<>(knownSize)}}) to avoid the repeated growth/copy, which happens on 
> every node, property and map entry written during compaction.
> No behavioral change intended.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to