spmallette commented on a change in pull request #1062: TINKERPOP-2163 Improved performance of JavaTranslator method selection URL: https://github.com/apache/tinkerpop/pull/1062#discussion_r257676461
########## File path: gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/JavaTranslator.java ########## @@ -273,4 +274,20 @@ private Method getStartMethodFromAnonymousTraversal() { return null; } + + private static final class ReflectedMethod { + private final Method method; + private final Parameter[] parameters; + private final boolean hasVarArgs; + + public ReflectedMethod(final Method m) { + this.method = m; + + // the reflection getParameters() method calls clone() every time to get the Parameter array. caching it + // saves a lot of extra processing + this.parameters = m.getParameters(); + + this.hasVarArgs = parameters.length > 0 && parameters[method.getParameters().length - 1].isVarArgs(); Review comment: thanks. i should not have missed that. i'll change it and re-run the benchmark. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services