Skip to content

Commit

Permalink
Improve performance of PathRetractionStrategy
Browse files Browse the repository at this point in the history
Helpful for traversals with lots of children where labels don't need to propagate. CTR
  • Loading branch information
spmallette committed Mar 4, 2024
1 parent 1efe40b commit beb1a5f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
* Fixed a bug in Gremlin.Net for .NET 8 that led to exceptions: `InvalidOperationException: Enumeration has not started. Call MoveNext.`
* Fixed message requestId serialization in `gremlin-python`.
* Improved performance of `PathRetractionStrategy` for traversals that carry many children, but don't hold many labels to propogate.
* Fixed bug in bytecode translation of `g.tx().commit()` and `g.tx().rollback()` in all languages.
* Improved error message from `JavaTranslator` by including exception source.
* Added missing `short` serialization (`gx:Int16`) to GraphSONV2 and GraphSONV3 in `gremlin-python`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,10 @@ private static boolean isNotApplicable(final Traversal.Admin<?, ?> traversal) {
}

private void applyToChildren(final Set<String> keepLabels, final List<Traversal.Admin<Object, Object>> children) {
// if there are no labels to keep, then there no need to iterate all the children because we won't be
// adding anything PathProcessor keepLabels - avoids the added recursion
if (keepLabels.isEmpty()) return;

for (final Traversal.Admin<Object, Object> child : children) {
TraversalHelper.applyTraversalRecursively(trav -> addLabels(trav, keepLabels), child);
}
Expand Down

0 comments on commit beb1a5f

Please sign in to comment.