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 "Julian Sedding (JIRA)" <ji...@apache.org> on 2018/07/27 13:56:00 UTC

[jira] [Created] (OAK-7668) Optimization: SegmentNodeState#fastEquals should compare getStableIdBytes instead of getStableId

Julian Sedding created OAK-7668:
-----------------------------------

             Summary: Optimization: SegmentNodeState#fastEquals should compare getStableIdBytes instead of getStableId
                 Key: OAK-7668
                 URL: https://issues.apache.org/jira/browse/OAK-7668
             Project: Jackrabbit Oak
          Issue Type: Improvement
          Components: segment-tar
    Affects Versions: 1.9.6
            Reporter: Julian Sedding


I have observed via stack trace sampling that during the installation of a Vault package with many small nodes on an otherwise quiet system, about 1/4 of stack traces had the following lines on the top (this was on Oak 1.6.11, but reading the code it applies equally on trunk):

{code}
at java.lang.String.valueOf(String.java:2994)
at java.lang.StringBuilder.append(StringBuilder.java:131)
at org.apache.jackrabbit.oak.segment.SegmentNodeState.getStableId(SegmentNodeState.java:124)+
at org.apache.jackrabbit.oak.segment.SegmentNodeState.fastEquals(SegmentNodeState.java:632)
...
{code}

I suggest comparing the result of {{SegmentNodeState#getStableIdBytes}} instead of {{SegmentNodeState#getStableId}}, which bypasses building the String representation.

So far I have no proof in the form of a benchmark, but it seems quite clear that this change will result in less work being performed.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)