[ https://issues.apache.org/jira/browse/OAK-9332?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17293799#comment-17293799 ]
Angela Schreiber commented on OAK-9332: --------------------------------------- [~miroslav], looks good to me :) > Document best practices and anti-patterns in repository tree traversal > ------------------------------------------------------------------------ > > Key: OAK-9332 > URL: https://issues.apache.org/jira/browse/OAK-9332 > Project: Jackrabbit Oak > Issue Type: Improvement > Components: doc > Reporter: Miroslav Smiljanic > Priority: Major > > When using JCR API, there is more than one way to perform tree/path traversal: > {code:java} > Node c = session.getNode("/a/b/c"); > Node d = null; > //get child node > d = session.getNode("/a/b/c/d"); > d = c.getNode("d"); > // get parent node > c = d.getParent(); > c = session.getNode("/a/b/c"); > {code} > To traverse a path using Node API with performs better compared to Session > API. > {noformat} > > java -jar target/oak-benchmarks-*-SNAPSHOT.jar benchmark > > GetParentNodeWithNodeAPI GetParentNodeWithSessionAPI Oak-Segment-Tar > Apache Jackrabbit Oak 1.37-SNAPSHOT > # GetParentNodeWithNodeAPI C min 10% 50% 90% max > N mean > Oak-Segment-Tar 1 2 2 2 3 5 > 25891 2 > # GetParentNodeWithSessionAP C min 10% 50% 90% max > N mean > Oak-Segment-Tar 1 26 27 29 32 40 > 2069 29{noformat} > Example where Session API is used: > https://issues.apache.org/jira/browse/SLING-10011 > Considering Oak implementation details (tree repository structure, ACL > evaluation, ...) the best practice for path traversal should be explicitly > documented. -- This message was sent by Atlassian Jira (v8.3.4#803005)