jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tobias Bocanegra (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (JCR-3793) vlt: with many child nodes, NodeNameList.restoreOrder is very slow with Oak
Date Wed, 02 Jul 2014 21:35:25 GMT

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

Tobias Bocanegra commented on JCR-3793:
---------------------------------------

Of course we can optimize the clients to do only the ordering if needed. but the algorithm
in NodeNameList does "restore" the order by ordering the nodes from back to front. if the
list is already in the correct order, it should be a no-op. So I don't see that there should
be a performance difference  if the client first checks the order or if Oak does it.

btw: the API could benefit of a {{Node.setChildNodeOrder(String[] names)}} method for such
cases.



> vlt: with many child nodes, NodeNameList.restoreOrder is very slow with Oak
> ---------------------------------------------------------------------------
>
>                 Key: JCR-3793
>                 URL: https://issues.apache.org/jira/browse/JCR-3793
>             Project: Jackrabbit Content Repository
>          Issue Type: Improvement
>            Reporter: Thomas Mueller
>         Attachments: JCR-3793.patch, ReorderTest.java
>
>
> The method org.apache.jackrabbit.vault.fs.api.NodeNameList.restoreOrder re-orders orderable
child nodes by using Node.orderBefore. This is very slow if there are many child nodes, specially
with Oak (minutes for 10'000 nodes, while only about 1 second for Jackrabbit 2.x).
> [~tripod], I wonder if a possible solution is to first check whether re-ordering is needed?
For example using:
> {noformat}
>     boolean isOrdered(ArrayList<String> names, Node parent)
>             throws RepositoryException {
>         NodeIterator it1 = parent.getNodes();
>         for (Iterator<String> it2 = names.iterator(); it2.hasNext();) {
>             if (!it1.hasNext() || !it1.nextNode().getName().equals(it2.next())) {
>                 return false;
>             }
>         }
>         return !it1.hasNext();
>     }
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message