angela created OAK-3615:
---------------------------

             Summary: Add initial capacity to StringBuilder used to calculate 
path of a tree
                 Key: OAK-3615
                 URL: https://issues.apache.org/jira/browse/OAK-3615
             Project: Jackrabbit Oak
          Issue Type: Improvement
          Components: core
            Reporter: angela
            Assignee: angela
            Priority: Minor


while benchmarking permission evaluation on the oak level (without having 
oak-jcr overhead), i spotted that the {{StringBuilder}} used to calculate the 
path of a tree often needs to increase it's capacity. Extract from the profiler 
info reported in oak-run:

{code}
at java.util.Arrays.copyOf(Arrays.java:2882)
at 
java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:100)
at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:390)
at java.lang.StringBuilder.append(StringBuilder.java:119)
at 
org.apache.jackrabbit.oak.plugins.tree.impl.AbstractTree.buildPath(AbstractTree.java:206)
at 
org.apache.jackrabbit.oak.plugins.tree.impl.AbstractTree.buildPath(AbstractTree.java:205)
at 
org.apache.jackrabbit.oak.plugins.tree.impl.AbstractTree.getPath(AbstractTree.java:197)
{code}

Would it make sense to initialize the {{StringBuilder}} with some initial 
capacity? Afaik the default is 16 which doesn't seem sufficient for a default 
path as we are experiencing them in an Oak instance.

[~mduerig], what do you think?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to