tinkerpop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [tinkerpop] FlorianHockmann opened a new pull request #1273: TINKERPOP-2349 Migrate JSON serialization to System.Text.Json in Gremlin.NET
Date Wed, 01 Apr 2020 10:01:29 GMT
FlorianHockmann opened a new pull request #1273: TINKERPOP-2349 Migrate JSON serialization
to System.Text.Json in Gremlin.NET
URL: https://github.com/apache/tinkerpop/pull/1273
 
 
   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

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message