[
https://issues.apache.org/jira/browse/TINKERPOP-1312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15300506#comment-15300506
]
Daniel Kuppitz edited comment on TINKERPOP-1312 at 5/25/16 5:48 PM:
--------------------------------------------------------------------
Benchmarking {{g.V().filter(outE("sungBy").count().limit(1).is(0))}} vs.
{{g.V().filter(__.not(outE("sungBy")))}} over the Grateful Dead graph revealed
the following:
{noformat}
== Iteration 1 ==
Using RangeStep: 1.8227029419999998
Using NotStep: 0.925998072
== Iteration 2 ==
Using RangeStep: 1.6838737179999999
Using NotStep: 0.855396789
== Iteration 3 ==
Using RangeStep: 1.642534355
Using NotStep: 0.786084641
== Iteration 4 ==
Using RangeStep: 1.637210378
Using NotStep: 0.794663864
{noformat}
I've made a few more iterations and also changed the order in which the
traversals were executed; the results were consistent in that using {{NotStep}}
takes only 50% (or less) of the time that it takes with {{RangeStep}}.
was (Author: dkuppitz):
Benchmarking {{g.V().filter()}} vs. {{g.V().filter()}} over the Grateful Dead
graph revealed the following:
{noformat}
== Iteration 1 ==
Using RangeStep: 1.8227029419999998
Using NotStep: 0.925998072
== Iteration 2 ==
Using RangeStep: 1.6838737179999999
Using NotStep: 0.855396789
== Iteration 3 ==
Using RangeStep: 1.642534355
Using NotStep: 0.786084641
== Iteration 4 ==
Using RangeStep: 1.637210378
Using NotStep: 0.794663864
{noformat}
I've made a few more iterations and also changed the order in which the
traversals were executed; the results were consistent in that using {{NotStep}}
takes only 50% (or less) of the time that it takes with {{RangeStep}}.
> .is.count(0) is not properly optimized
> --------------------------------------
>
> Key: TINKERPOP-1312
> URL: https://issues.apache.org/jira/browse/TINKERPOP-1312
> Project: TinkerPop
> Issue Type: Improvement
> Affects Versions: 3.2.0-incubating, 3.1.2-incubating
> Reporter: Daniel Kuppitz
> Assignee: Daniel Kuppitz
> Fix For: 3.1.3, 3.2.1
>
>
> {{bla.count().is(0)}} gets optimized by {{RangeByIsCountStrategy}}, which
> replaces it with {{bla.limit(1).count().is(0)}}. That's good, but we can do
> even better by replacing it with {{__.not(bla)}}, which is a simple
> {{.hasNext()}} instead of a {{RangeStep}} followed by a
> {{ReducingBarrierStep}} ({{count()}}).
> Question is: should we do the replacement in {{RangeByIsCountStrategy}}? The
> strategy will recognize the pattern, no matter if we use it for the
> replacement or not; it's just that the strategy name is then no longer in
> line with the the actual replacement (for this particular {{.count().is(0)}}
> case) as it won't inject a {{RangeStep}}.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)