Hi,

Bindings are useful for ScriptEngine-based Gremlin variants where the String 
script can be compiled and ScriptEngine.bindings can be set. That is, this is 
useful in parameterized scripts situations 
(http://tinkerpop.apache.org/docs/current/reference/#parameterized-scripts 
<http://tinkerpop.apache.org/docs/current/reference/#parameterized-scripts>).

In Gremlin-Java, bindings are not useful as Java reflection is leveraged to 
construct the Traversal from Bytecode and it is already smokin’ fast to do so 
relative to String parsing a script.

Here are the runtimes. As you can see, bindings are important w/ Gremlin-Groovy 
and not so for Gremlin-Java.

gremlin> clock(1000){ JavaTranslator.of(g).translate(bytecode) } // reflection 
(Gremlin-Java)
==>0.004768085
gremlin> clock(1000){ compiled.eval(bindings) } // caching (Gremlin-Groovy)
==>0.015168259
gremlin> clock(1000){ groovy.reset(); 
groovy.eval(GroovyTranslator.of('g').translate(bytecode), bindings) } // no 
caching (Gremlin-Groovy)
==>40.790075693
gremlin>

HTH,
Marko.

http://markorodriguez.com



> On Nov 29, 2016, at 5:05 AM, Robert Dale <[email protected]> wrote:
> 
> I was looking at TINKERPOP-1444 and a conclusion was that Bytecode with
> Bindings can't be cached.  If that's true, is there any advantage to using
> Bindings?
> 
> Robert Dale

Reply via email to