GitHub user spmallette opened a pull request:
https://github.com/apache/tinkerpop/pull/839
TINKERPOP-1936 Improved performance of Bytecode deserialization.
https://issues.apache.org/jira/browse/TINKERPOP-1936
GraphSON deserialization of `Bytecode` was using generic `List`
deserialization which became especially costly for Jackson in 2.5.x because of
changes that synchronized access to the deserialization cache and because the
collection deserialization were no longer cacheable when type deserialization
was in play. This change removed the use of generic type lists in
deserialization and more directly handled the parsing of the lists thus
bypassing the collection deserializer for this specific case.
A simple microbenchmark showed a pretty major improvement in performance
with this change:
```groovy
mapper =
GraphSONMapper.build().version(GraphSONVersion.V2_0).addCustomModule(GraphSONXModuleV2d0.build().create(false)).typeInfo(TypeInfo.PARTIAL_TYPES).create().createMapper()
bytecodeJSON1 =
"{\"@type\":\"g:Bytecode\",\"@value\":{\"step\":[[\"addV\",\"poc_int\"],[\"property\",\"bigint1value\",{\"@type\":\"g:Int64\",\"@value\":-4294967295}]]}}"
gremlin> clock(500000) { mapper.readValue(bytecodeJSON1, Bytecode.class) }
==>0.089718097358
gremlin> clock(500000) { mapper.readValue(bytecodeJSON1, Bytecode.class) }
==>0.002583748984
```
All tests pass with `docker/build.sh -t -i`
VOTE +1
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/apache/tinkerpop TINKERPOP-1936
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/tinkerpop/pull/839.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 #839
----
commit e68df44caaafd9f4037da8e03be660a4124555eb
Author: Stephen Mallette <spmva@...>
Date: 2018-04-12T14:25:20Z
TINKERPOP-1936 Improved performance of Bytecode deserialization.
GraphSON deserialization of Bytecode was using generic List deserialization
which became especially costly for Jackson in 2.5.x because of changes that
synchronized access to the deserialization cache and because the collection
deserialization were no longer cacheable when type deserialization was in play.
This change removed the use of generic type lists in deserialization and more
directly handled the parsing of the lists thus bypassing the collection
deserializer for this specific case.
----
---