Uploaded image for project: 'ModeShape'
  1. ModeShape
  2. MODE-2271

Improve performance of getting path of node that is below a large ancestor

XMLWordPrintable

      When obtaining a path for a node, we have to walk up the ancestors and, for each, find the reference for the child within the parent node. Attached is a method call timing table that shows that several methods make this quite a bit more expensive than need be. In particular, a lot of time is spent inside the Matcher.matches(...) method within the NameValueFactory.create(...) method. And, when trying to find a child and its name within the parent, the LazyCachedNode.parentReferenceToSelf(WorkspaceCache) is getting the complete list of all child references via the LazyCachedNode.getChildReferences(...) method call.

      Both of these need to be fixed.

      org.modeshape.jcr.JcrNode.getPath()
        org.modeshape.jcr.AbstractJcrNode.path()
          org.modeshape.jcr.cache.document.LazyCachedNode.getPath(NodeCache)
            org.modeshape.jcr.cache.document.LazyCachedNode.getSegment(WorkspaceCache)
              org.modeshape.jcr.cache.document.LazyCachedNode.parentReferenceToSelf(WorkspaceCache)
                org.modeshape.jcr.cache.document.LazyCachedNode.getChildReferences(NodeCache)  <========
                  org.modeshape.jcr.cache.document.DocumentTranslator.getChildReferences(WorkspaceCache, Document)
                    org.modeshape.jcr.cache.document.DocumentTranslator.childReferencesListFromArray(List)
                      org.modeshape.jcr.cache.document.DocumentTranslator.childReferenceFrom(Object)
                        org.modeshape.jcr.value.basic.NameValueFactory.create(String, TextDecoder)
                          org.modeshape.jcr.value.basic.NameValueFactory.create(String, TextDecoder)
                            java.util.regex.Matcher.matches()  <========
                            java.util.regex.Pattern.matcher(CharSequence)
                            org.modeshape.jcr.SystemNamespaceRegistry.getNamespaceForPrefix(String)
                            org.modeshape.jcr.value.basic.BasicName.<init>(String, String)
                        org.infinispan.schematic.internal.document.BasicDocument.getString(String)
                        org.modeshape.jcr.cache.ChildReference.<init>(NodeKey, Name, int)
                    org.modeshape.jcr.cache.document.ImmutableChildReferences.create(List)
                      org.modeshape.jcr.cache.document.ImmutableChildReferences$Medium.<init>(Iterable)
                        org.modeshape.common.collection.LinkedListMultimap.put(Object, Object)
                          org.modeshape.common.collection.LinkedListMultimap.addEntryFor(Object, Object)
                        java.util.HashMap.put(Object, Object)
      

            rhauch Randall Hauch (Inactive)
            rhauch Randall Hauch (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: