[
https://issues.apache.org/jira/browse/TINKERPOP-1936?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16439783#comment-16439783
]
ASF GitHub Bot commented on TINKERPOP-1936:
-------------------------------------------
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.
----
> Performance enhancement to Bytecode deserialization
> ---------------------------------------------------
>
> Key: TINKERPOP-1936
> URL: https://issues.apache.org/jira/browse/TINKERPOP-1936
> Project: TinkerPop
> Issue Type: Improvement
> Components: io
> Affects Versions: 3.2.8
> Reporter: stephen mallette
> Assignee: stephen mallette
> Priority: Major
> Fix For: 3.4.0, 3.2.9, 3.3.3
>
>
> There is a bad bottleneck in Jackson deserialization of {{Bytecode}}. It
> doesn't become extremely apparent until higher levels of load are reached and
> I think is even more evident after the latest bump in Jackson version where a
> bug fix in Jackson itself changed the way in which deserialization caching
> for collections was handled. {{Bytecode}} deserialization was relying on the
> standard Jackson collection deserializers and it costs quite considerably in
> terms of synchronized access to the deserializer cache and to the reflection
> calls required to sort out types.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)