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 "Marcel Reutegger (JIRA)" <ji...@apache.org> on 2014/01/30 10:22:12 UTC

[jira] [Updated] (OAK-825) Unnecessary performance overhead in MongoMK's calculation of keys for the nodeCache, nodeChildrenCache

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

Marcel Reutegger updated OAK-825:
---------------------------------

    Fix Version/s:     (was: 1.0)
                   0.16

> Unnecessary performance overhead in MongoMK's calculation of keys for the nodeCache, nodeChildrenCache
> ------------------------------------------------------------------------------------------------------
>
>                 Key: OAK-825
>                 URL: https://issues.apache.org/jira/browse/OAK-825
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: mongomk
>    Affects Versions: 0.7
>            Reporter: Lukas Eder
>            Assignee: Marcel Reutegger
>             Fix For: 0.16
>
>         Attachments: MongoMK.nodeCache.png
>
>
> The key of MongoMK.nodeCache and nodeChildrenCache is currently a String, whose evaluation is somewhat expensive:
> {code}
> path + "@" + rev
> {code}
> In the above code, "rev.toString()" internally creates another StringBuilder to generate another intermediate string. The attached screenshot shows that around 5% of profiling time within "MongoMK.getNode()" is wasted in order to calculate the caching key. Other methods are also affected.
> A simple way to improve this is to reuse a single StringBuilder for the key, as such:
> {code}
> StringBuilder sb = new StringBuilder();
> sb.append(path);
> sb.append("@");
> rev.appendTo(sb);
> {code}
> A better way would probably be to wrap "path" and "rev" in another re-usable "NodeRev" object to be used instead of using two references "path" and "rev". The "NodeRev" object would provide appropriate equals() and hashCode() implementations.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)