Return-Path: Delivered-To: apmail-jackrabbit-dev-archive@www.apache.org Received: (qmail 26101 invoked from network); 8 Nov 2010 10:52:19 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 8 Nov 2010 10:52:19 -0000 Received: (qmail 79495 invoked by uid 500); 8 Nov 2010 10:52:50 -0000 Delivered-To: apmail-jackrabbit-dev-archive@jackrabbit.apache.org Received: (qmail 79404 invoked by uid 500); 8 Nov 2010 10:52:49 -0000 Mailing-List: contact dev-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jackrabbit.apache.org Delivered-To: mailing list dev@jackrabbit.apache.org Received: (qmail 79394 invoked by uid 99); 8 Nov 2010 10:52:48 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Nov 2010 10:52:48 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Nov 2010 10:52:46 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id oA8AqOkr018617 for ; Mon, 8 Nov 2010 10:52:24 GMT Message-ID: <21165902.72961289213544608.JavaMail.jira@thor> Date: Mon, 8 Nov 2010 05:52:24 -0500 (EST) From: "Thomas Mueller (JIRA)" To: dev@jackrabbit.apache.org Subject: [jira] Resolved: (JCR-2033) Node.orderBefore is slow In-Reply-To: <82064859.1237367270808.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/JCR-2033?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Thomas Mueller resolved JCR-2033. --------------------------------- Resolution: Won't Fix I don't plan to work in this issue for Jackrabbit 2.x. We should ensure it's solved in Jackrabbit 3 however. > Node.orderBefore is slow > ------------------------ > > Key: JCR-2033 > URL: https://issues.apache.org/jira/browse/JCR-2033 > Project: Jackrabbit Content Repository > Issue Type: Improvement > Components: jackrabbit-core > Reporter: Thomas Mueller > Assignee: Thomas Mueller > Priority: Minor > > Use case: I have a node with a medium number of child nodes, and want to sort the child nodes. To do that, I use Node.orderBefore. > This is slow (31 seconds to sort 2000 child nodes), O(n^2). > Workarounds: > 1) don't use that many child nodes > 2) instead of using orderBefore, create a new node with the children in the right order > Test case: > Session session = new TransientRepository().login(new SimpleCredentials("", new char[0])); > Node root = session.getRootNode(); > Node test = root.hasNode("test") ? root.getNode("test") : root.addNode("test"); > long start = System.currentTimeMillis(); > int len = 2000; > for (int i = 0; i < len; i++) { > test.addNode("n" + i); > } > System.out.println("creating: " + (System.currentTimeMillis() - start)); > session.save(); > start = System.currentTimeMillis(); > for (int i = 0; i < len; i++) { > test.orderBefore("n" + i, null); > } > System.out.println("sorted: " + (System.currentTimeMillis() - start)); > session.logout(); > Output: > creating: 712 > sorted: 31281 > Possible solutions: > - speed up Node.orderBefore > - create a 'sorting tool' that uses the 'create new node' trick > - create a new (Jackrabbit internal) solution to sort quickly -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.