You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by "FlorianHockmann (GitHub)" <gi...@apache.org> on 2020/04/01 10:01:29 UTC
[GitHub] [tinkerpop] FlorianHockmann opened pull request #1273:
TINKERPOP-2349 Migrate JSON serialization to System.Text.Json in Gremlin.NET
https://issues.apache.org/jira/browse/TINKERPOP-2349
.NET Core 3.0 is added as a target framework as it already includes support for `System.Text.Json` and therefore doesn't need the NuGet package.
Results from a simple benchmark with BenchmarkDotNet showed that this improves the performance of the deserialization roughly by a factor of 2. The deserialization now also allocates far less memory, by a factor of ~7 which also results in less garbage collections. The performance of the serialization however stayed basically the same. It got even slightly slower by ~4% in this benchmark, but it also
allocates a bit less memory (-12%). This seems acceptable in my opinion, given that it is only a very small increase, especially compared to the differences for the deserialization and because it allocates less
memory now.
Output from BenchmarkDotNet:
Before:
| Method | Mean | Error | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---------------- |---------:|---------:|---------:|-------:|-------:|------:|----------:|
| Serialization | 22.41 us | 0.616 us | 0.659 us | 1.5564 | - | - | 9.72 KB |
| Deserialization | 40.50 us | 1.075 us | 1.150 us | 6.3477 | 0.6104 | - | 39.06 KB |
After:
| Method | Mean | Error | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---------------- |---------:|---------:|---------:|-------:|------:|------:|----------:|
| Serialization | 23.25 us | 0.103 us | 0.091 us | 1.3733 | - | - | 8.58 KB |
| Deserialization | 25.89 us | 0.583 us | 0.545 us | 0.9155 | - | - | 5.74 KB |
Another advantage of using System.Text.Json is that it supports [`Span<T>`](https://docs.microsoft.com/en-us/archive/msdn-magazine/2018/january/csharp-all-about-span-exploring-a-new-net-mainstay) so we could make use of that in the future to reduce memory allocations in the driver even more.
VOTE +1
[ Full content available at: https://github.com/apache/tinkerpop/pull/1273 ]
This message was relayed via gitbox.apache.org for dev@tinkerpop.apache.org
[GitHub] [tinkerpop] jorgebay commented on pull request #1273:
TINKERPOP-2349 Migrate JSON serialization to System.Text.Json in Gremlin.NET
Posted by "jorgebay (GitHub)" <gi...@apache.org>.
It will be resolved automatically for `netcoreapp3.0` users.
[ Full content available at: https://github.com/apache/tinkerpop/pull/1273 ]
This message was relayed via gitbox.apache.org for dev@tinkerpop.apache.org
[GitHub] [tinkerpop] FlorianHockmann commented on pull request #1273:
TINKERPOP-2349 Migrate JSON serialization to System.Text.Json in Gremlin.NET
Posted by "FlorianHockmann (GitHub)" <gi...@apache.org>.
Good to know. Then I'll remove this target again.
[ Full content available at: https://github.com/apache/tinkerpop/pull/1273 ]
This message was relayed via gitbox.apache.org for dev@tinkerpop.apache.org