You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by "spmallette (GitHub)" <gi...@apache.org> on 2019/02/16 00:52:33 UTC

[GitHub] [tinkerpop] spmallette opened pull request #1062: TINKERPOP-2163 Improved performance of JavaTranslator method selection

https://issues.apache.org/jira/browse/TINKERPOP-2163

Every time I think there's nothing else to squeeze out of this class I find something new. This time I cached results of `Method.getParameters()` as well as varargs checks. The former offered the bigger benefit as calls to that method forced a `clone()` of the parameter array, but the latter also helped.

Prior to the change on `tp33` we were getting:

```text
Benchmark                                             Mode  Cnt        Score       Error  Units
JavaTranslatorBenchmark.testTranslationLong          thrpt   20    25812.057 ±   504.233  ops/s
JavaTranslatorBenchmark.testTranslationMedium        thrpt   20   316019.034 ± 13852.097  ops/s
JavaTranslatorBenchmark.testTranslationShort         thrpt   20  1403109.145 ± 41460.176  ops/s
JavaTranslatorBenchmark.testTranslationWithStrategy  thrpt   20    49316.015 ±  1701.437  ops/s
```

and now, with this change, we're looking at:

```text
Benchmark                                             Mode  Cnt        Score       Error  Units
JavaTranslatorBenchmark.testTranslationLong          thrpt   20    30270.986 ±   553.973  ops/s
JavaTranslatorBenchmark.testTranslationMedium        thrpt   20   385286.380 ±  6572.709  ops/s
JavaTranslatorBenchmark.testTranslationShort         thrpt   20  1724457.005 ± 11173.083  ops/s
JavaTranslatorBenchmark.testTranslationWithStrategy  thrpt   20    60989.899 ±   533.268  ops/s
```

That's roughly 20% improvement. Not bad.

All tests pass with `docker/build.sh -t -n -i`

VOTE +1



[ Full content available at: https://github.com/apache/tinkerpop/pull/1062 ]
This message was relayed via gitbox.apache.org for dev@tinkerpop.apache.org

[GitHub] [tinkerpop] dkuppitz commented on issue #1062: TINKERPOP-2163 Improved performance of JavaTranslator method selection

Posted by "dkuppitz (GitHub)" <gi...@apache.org>.
VOTE +1

[ Full content available at: https://github.com/apache/tinkerpop/pull/1062 ]
This message was relayed via gitbox.apache.org for dev@tinkerpop.apache.org

[GitHub] [tinkerpop] nastra commented on issue #1062: TINKERPOP-2163 Improved performance of JavaTranslator method selection

Posted by "nastra (GitHub)" <gi...@apache.org>.
@spmallette yep LGTM

[ Full content available at: https://github.com/apache/tinkerpop/pull/1062 ]
This message was relayed via gitbox.apache.org for dev@tinkerpop.apache.org

[GitHub] [tinkerpop] spmallette commented on issue #1062: TINKERPOP-2163 Improved performance of JavaTranslator method selection

Posted by "spmallette (GitHub)" <gi...@apache.org>.
@nastra i assume that this would accomplish what you're saying without having to change all the code that uses `argumentsCopy`:

`final Object[] argumentsCopy = arguments.length > 0 ? new Object[arguments.length] : arguments;`

[ Full content available at: https://github.com/apache/tinkerpop/pull/1062 ]
This message was relayed via gitbox.apache.org for dev@tinkerpop.apache.org

[GitHub] [tinkerpop] spmallette closed pull request #1062: TINKERPOP-2163 Improved performance of JavaTranslator method selection

Posted by "spmallette (GitHub)" <gi...@apache.org>.
[ pull request closed by spmallette ]

[ Full content available at: https://github.com/apache/tinkerpop/pull/1062 ]
This message was relayed via gitbox.apache.org for dev@tinkerpop.apache.org

[GitHub] [tinkerpop] spmallette commented on pull request #1062: TINKERPOP-2163 Improved performance of JavaTranslator method selection

Posted by "spmallette (GitHub)" <gi...@apache.org>.
thanks. i should not have missed that. i'll change it and re-run the benchmark.

[ Full content available at: https://github.com/apache/tinkerpop/pull/1062 ]
This message was relayed via gitbox.apache.org for dev@tinkerpop.apache.org

[GitHub] [tinkerpop] robertdale commented on issue #1062: TINKERPOP-2163 Improved performance of JavaTranslator method selection

Posted by "robertdale (GitHub)" <gi...@apache.org>.
`docker/build.sh -i -t` success
VOTE +1

[ Full content available at: https://github.com/apache/tinkerpop/pull/1062 ]
This message was relayed via gitbox.apache.org for dev@tinkerpop.apache.org

[GitHub] [tinkerpop] nastra commented on issue #1062: TINKERPOP-2163 Improved performance of JavaTranslator method selection

Posted by "nastra (GitHub)" <gi...@apache.org>.
@spmallette one tiny suggestion to avoid creation of unnecessary arrays would be:
```
if (arguments.length > 0) {
            final Object[] argumentsCopy = new Object[arguments.length];
            for (int i = 0; i < arguments.length; i++) {
                argumentsCopy[i] = translateObject(arguments[i]);
            }
        }
```

[ Full content available at: https://github.com/apache/tinkerpop/pull/1062 ]
This message was relayed via gitbox.apache.org for dev@tinkerpop.apache.org

[GitHub] [tinkerpop] robertdale commented on pull request #1062: TINKERPOP-2163 Improved performance of JavaTranslator method selection

Posted by "robertdale (GitHub)" <gi...@apache.org>.
Replace `method.getParameters()` with `parameters`?

[ Full content available at: https://github.com/apache/tinkerpop/pull/1062 ]
This message was relayed via gitbox.apache.org for dev@tinkerpop.apache.org