[
https://issues.apache.org/jira/browse/TINKERPOP3-993?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15034421#comment-15034421
]
Daniel Kuppitz commented on TINKERPOP3-993:
-------------------------------------------
The difference is significant, at least for an in-memory graph. I've used the
following script:
{code}
loops = 10000
println "\n2 loops, simple path"
g = TinkerFactory.createModern().traversal()
clock(loops) {g.V().repeat(both()).times(2).simplePath().path().count().next()}
println "\n2 loops, no simple path"
g = TinkerFactory.createModern().traversal()
x = clock(loops)
{g.V().repeat(both()).times(2).not(simplePath()).path().count().next()}
println "\n2 loops, cyclic path"
g = TinkerFactory.createModern().traversal()
y = clock(loops)
{g.V().repeat(both()).times(2).cyclicPath().path().count().next()}
println "\ncyclicPath() is ${x/y} times faster than not(simplePath())\n"
println "\n3 loops, simple path"
g = TinkerFactory.createModern().traversal()
clock(loops) {g.V().repeat(both()).times(3).simplePath().path().count().next()}
println "\n3 loops, no simple path"
g = TinkerFactory.createModern().traversal()
x = clock(loops)
{g.V().repeat(both()).times(3).not(simplePath()).path().count().next()}
println "\n3 loops, cyclic path"
g = TinkerFactory.createModern().traversal()
y = clock(loops)
{g.V().repeat(both()).times(3).cyclicPath().path().count().next()}
println "\ncyclicPath() is ${x/y} times faster than not(simplePath())\n"
{code}
...and got pretty consistent results in several runs ({{cyclicPath()}} is
always ~1.4 times faster than {{not(simplePath())}}.
**Sample Output:**
{noformat}
gremlin> :load /tmp/cycle-benchmark.groovy
==>10000
2 loops, simple path
==>null
==>graphtraversalsource[tinkergraph[vertices:6 edges:6], standard]
==>0.152958823
2 loops, no simple path
==>null
==>graphtraversalsource[tinkergraph[vertices:6 edges:6], standard]
==>0.19251052159999998
2 loops, cyclic path
==>null
==>graphtraversalsource[tinkergraph[vertices:6 edges:6], standard]
==>0.1364644781
cyclicPath() is 1.4107006034121927 times faster than not(simplePath())
==>null
3 loops, simple path
==>null
==>graphtraversalsource[tinkergraph[vertices:6 edges:6], standard]
==>0.21692513079999998
3 loops, no simple path
==>null
==>graphtraversalsource[tinkergraph[vertices:6 edges:6], standard]
==>0.3573207602
3 loops, cyclic path
==>null
==>graphtraversalsource[tinkergraph[vertices:6 edges:6], standard]
==>0.24871238319999997
cyclicPath() is 1.4366826275500062 times faster than not(simplePath())
==>null
{noformat}
> cyclicPath is not(simplePath)
> -----------------------------
>
> Key: TINKERPOP3-993
> URL: https://issues.apache.org/jira/browse/TINKERPOP3-993
> Project: TinkerPop 3
> Issue Type: Bug
> Components: process
> Affects Versions: 3.0.2-incubating
> Reporter: Marko A. Rodriguez
> Fix For: 3.1.1-incubating
>
>
> A simple way to get rid of some steps... Benchmark first.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)