[ 
https://issues.apache.org/jira/browse/OAK-825?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13659552#comment-13659552
 ] 

Thomas Mueller commented on OAK-825:
------------------------------------

Using a NodeRev class sounds like a good solution.

The biggest performance problem I see in my tests is that MongoDB documents can 
grow very large, because they are not split. I will first have a look at this 
problem.
                
> 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
>         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 is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to