[ https://issues.apache.org/jira/browse/TINKERPOP-3009?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17781895#comment-17781895 ]
ASF GitHub Bot commented on TINKERPOP-3009: ------------------------------------------- spmallette opened a new pull request, #2322: URL: https://github.com/apache/tinkerpop/pull/2322 https://issues.apache.org/jira/browse/TINKERPOP-3009 Note that TraverserGenerators changed a bit because of the filter patterns that were added, thus the assertion adjustments. Basically, rather than adding and(inV()..., outV()...) for every single edge step it's done more strategically such that only the direction not already traversed gets filtered. Also avoids some retesting of vertices if they were already handled. Before: {code} gremlin> g.withStrategies(SubgraphStrategy.build(). ......1> vertices(hasLabel('x','y','z')).create()). ......2> V().out().profile() ==>Traversal Metrics Step Count Traversers Time (ms) % Dur ============================================================================================================= TinkerGraphStep(vertex,[~label.within([x, y, z])]) 0.160 58.50 VertexStep(OUT,edge) 0.017 6.53 AndStep([[EdgeVertexStep(IN), HasStep([~label.w... 0.017 6.19 EdgeVertexStep(IN) 0.000 HasStep([~label.within([x, y, z])]) 0.000 EdgeVertexStep(OUT) 0.000 HasStep([~label.within([x, y, z])]) 0.000 EdgeVertexStep(IN) 0.064 23.59 HasStep([~label.within([x, y, z])]) {code} and after: {code} gremlin> g.withStrategies(new SubgraphStrategy(vertices: __.has("name", P.within("josh", "lop", "ripple")))).V().out().profile() ==>Traversal Metrics Step Count Traversers Time (ms) % Dur ============================================================================================================= TinkerGraphStep(vertex,[name.within([josh, lop,... 3 3 8.231 95.09 VertexStep(OUT,vertex) 2 2 0.337 3.90 HasStep([name.within([josh, lop, ripple])]) 2 2 0.087 1.01 >TOTAL - - 8.656 - {code} > SubgraphStrategy produces excessive filtering when multiple labels are > filtered upon > ------------------------------------------------------------------------------------ > > Key: TINKERPOP-3009 > URL: https://issues.apache.org/jira/browse/TINKERPOP-3009 > Project: TinkerPop > Issue Type: Bug > Components: process > Affects Versions: 3.6.2 > Reporter: Brian O'Keefe > Priority: Critical > > See the example profile below. Notice the traversal includes _has _filters > everywhere repeatedly applied for vertices which are already filtered before > too. > {noformat} > gremlin> g.withStrategies(SubgraphStrategy.build(). > ......1> vertices(hasLabel('x','y','z')).create()). > ......2> V().out().profile() > ==>Traversal Metrics > Step Count > Traversers Time (ms) % Dur > ============================================================================================================= > TinkerGraphStep(vertex,[~label.within([x, y, z])]) > 0.160 58.50 > VertexStep(OUT,edge) > 0.017 6.53 > AndStep([[EdgeVertexStep(IN), HasStep([~label.w... > 0.017 6.19 > EdgeVertexStep(IN) > 0.000 > HasStep([~label.within([x, y, z])]) > 0.000 > EdgeVertexStep(OUT) > 0.000 > HasStep([~label.within([x, y, z])]) > 0.000 > EdgeVertexStep(IN) > 0.064 23.59 > HasStep([~label.within([x, y, z])]) > 0.014 5.18 > >TOTAL - > - 0.274 - > {noformat} -- This message was sent by Atlassian Jira (v8.20.10#820010)