ministat commented on PR #1873:
URL: https://github.com/apache/tinkerpop/pull/1873#issuecomment-1342218361

   @cole-bq I'm interested with your exploration. Using Java's Exception to 
stop the iteration is not recommended since it has to fill stack trace which 
hurts the performance. The workaround now is to use Exception without stack 
trace.
   
   I checked all places which catches the NoSuchElementException. Currently, 
there are some other places which catch the NoSuchElementException to stop the 
traversal, and none of them care about the stacktrace, just wants to break the 
loop or traversal, like this patch wants to address.
   
   Now, there are some other graph DB which already refers to Tinkerpop and 
depends on the exception to do something in their logic, like Janusgraph 
mentioned in this issue. So, if you prefer to some other solution, please 
consider the backward compatibility.  
   
   ```
   
src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalUtil.java:45:
        } catch (final NoSuchElementException e) {
   
src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalUtil.java:113:
        } catch (final NoSuchElementException e) {
   
src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/AbstractStep.java:156:
            } catch (final NoSuchElementException e) {
   
src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Traversal.java:187:
        } catch (final NoSuchElementException ignored) {
   
src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Traversal.java:212:
        } catch (final NoSuchElementException ignored) {
   
src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Traversal.java:267:
        } catch (final NoSuchElementException ignore) {
   
src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Traversal.java:280:
        } catch (final NoSuchElementException ignore) {
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to