You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-issues@jackrabbit.apache.org by "Nuno Santos (Jira)" <ji...@apache.org> on 2026/09/25 15:49:00 UTC
[jira] [Updated] (OAK-12413) Pre-size predictable ArrayList allocations in the compaction write path
[ https://issues.apache.org/jira/browse/OAK-12413?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Nuno Santos updated OAK-12413:
------------------------------
Description:
Several {{ArrayLists}} 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.
was:
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.
> 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 {{ArrayLists}} 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)