Uploaded image for project: 'Jackrabbit Oak'
  1. Jackrabbit Oak
  2. OAK-1172

AbstractTree.getChildrenCount() not very performant due to INTERNAL_NODE_NAMES

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 0.11
    • None
    • None

    Description

      the AbstractTree.getChildrenCount() does unnecessary checks for hidden names:

              long count = nodeBuilder.getChildNodeCount(max);
              for (String name : INTERNAL_NODE_NAMES) {
                  if (nodeBuilder.hasChildNode(name)) {
                      count--;
                  }
              }
      

      this is not optimal, especially because the nodebuilder creates child builders:

          public boolean hasChildNode(@Nonnull String name) {
              return getChildNode(name).exists();
          }
      

      Suggest: to extend the NodeBuilder.getChildNodeCount() method to accept an additional flag if to include hidden nodes or not.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              tripod Tobias Bocanegra
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: