Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-6230

Improve performance of accumulate with subnetwork

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: Major Major
    • None
    • None
    • None
    • None
    • Undefined
    • NEW
    • NEW

      Subnetworks can be improved, removing the need for any left input at all, which also avoids the double iteration. The start tuple is recorded as a field, and passed down to each child. Only right inputs are processed (there are no left inputs), instead of iterating the left memory, it looks up the field that subnetwork start tuple and processes that as normal.

      To achieve this:

      1) change builder to detect subnetwork as DO NOT create rete child link connection, do not attach the left input of the accumulate node.
      2) change the iterator, so it only returns the field from the RT.

      FastIterator leftIt = accNode.getLeftIterator( ltm );
      for ( LeftTuple leftTuple = accNode.getFirstLeftTuple( rightTuple, ltm, leftIt ); leftTuple != null; leftTuple = (LeftTuple) leftIt.next( leftTuple ) ) {

      literally we just need to subvert accNode.getLeftIterator( ltm ); so it only returns a single LT from the RT field.

      plus this needs short circuiting, so it always returns true for subetnoroks the optimzation i mention already.

      if ( constraints.isAllowedCachedRight( contextEntry, leftTuple ) ) {

       

       

              mfusco@redhat.com Mario Fusco
              mfusco@redhat.com Mario Fusco
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: