GitHub user okram opened a pull request:

    https://github.com/apache/tinkerpop/pull/411

    TINKERPOP-14444: Benchmark bytecode->Traversal creation and implement 
GremlinServer cache if necessary.

    https://issues.apache.org/jira/browse/TINKERPOP-1444
    
    GremlinServer caching `Map<Bytecode,Traversal>` is only powerful (really 
powerful) when bindings are not involved (a solid 50x+ increase in speed). 
However, given that production systems will typically have bindings in their 
traversals, then such a cache doesn't help. 
    
    In its place, a update to `JavaTranslator` is provided that makes use of an 
internal static `METHOD_CACHE` so as to make reflection faster. The speed up is 
provided below:
    
    ```
    Prior to method caching:
      Bytecode->JavaTranslator call    : 0.13305238800000002
    After method caching:
      Bytecode->JavaTranslator call    : 0.054839154
    ```
    
    CHANGELOG
    
    ```
    * Added a static method cache to `JavaTranslator` to reduce the cost of 
Java reflection.
    ```
    
    @spmallette --- if you think that a `Map<Bytecode,Traversal>` cache IS 
necessary for GremlinServer,  then  please VOTE -1 and we can collaborate on 
this branch to also include a bytecode-cache.


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/apache/tinkerpop TINKERPOP-1444

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/tinkerpop/pull/411.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #411
    
----
commit 2a2b59b15833d80587bb8127d6edfd38a17ab788
Author: Marko A. Rodriguez <[email protected]>
Date:   2016-09-13T19:23:32Z

    JavaTranslator now makes use of a static method cache. This speeds up 
Bytecode->JavaTranslator translation. From 0.098ms to 0.029ms. If a 
GremlinServer Bytecode cache is not desired, then, at minimum we should use 
this JavaTranslator update in its place.

commit ed8feea52e2055edcd45cd5c97f8ef3d60cc6820
Author: Marko A. Rodriguez <[email protected]>
Date:   2016-09-13T19:30:27Z

    removed this. from a static field name call. minor nothing.

commit 1fc52cb2d208fb0949e66f2e1cf2c1307495a537
Author: Marko A. Rodriguez <[email protected]>
Date:   2016-09-13T19:34:47Z

    reduced complexity by having a single GLOBAL_METHOD_CACHE for both 
Traversal and TraversalSource methods. Cleaner code with less instanceof stuff.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to