Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use JsonSerializer.SerializeToUtf8Bytes when doing a round trip #5006

Merged
merged 1 commit into from Feb 4, 2021

Conversation

Bond-009
Copy link
Member

This test uses a very small object (CountryInfo), using a bigger object
would increase the difference in allocated memory.

BenchmarkDotNet=v0.12.1, OS=fedora 32
Intel Core i7-6700HQ CPU 2.60GHz (Skylake), 1 CPU, 8 logical and 4 physical cores
.NET Core SDK=5.0.100
  [Host]     : .NET Core 5.0.0 (CoreCLR 5.0.20.51904, CoreFX 5.0.20.51904), X64 RyuJIT
  DefaultJob : .NET Core 5.0.0 (CoreCLR 5.0.20.51904, CoreFX 5.0.20.51904), X64 RyuJIT

|          Method |       Mean |    Error |   StdDev |  Gen 0 | Gen 1 | Gen 2 | Allocated |
|---------------- |-----------:|---------:|---------:|-------:|------:|------:|----------:|
|  RoundTripBytes |   932.0 ns |  5.09 ns |  4.25 ns | 0.1173 |     - |     - |     368 B |
| RoundTripString | 1,114.8 ns | 22.19 ns | 23.74 ns | 0.1469 |     - |     - |     464 B |

This test uses a very small object (CountryInfo), using a bigger object
would increase the difference in allocated memory.

```
BenchmarkDotNet=v0.12.1, OS=fedora 32
Intel Core i7-6700HQ CPU 2.60GHz (Skylake), 1 CPU, 8 logical and 4 physical cores
.NET Core SDK=5.0.100
  [Host]     : .NET Core 5.0.0 (CoreCLR 5.0.20.51904, CoreFX 5.0.20.51904), X64 RyuJIT
  DefaultJob : .NET Core 5.0.0 (CoreCLR 5.0.20.51904, CoreFX 5.0.20.51904), X64 RyuJIT

|          Method |       Mean |    Error |   StdDev |  Gen 0 | Gen 1 | Gen 2 | Allocated |
|---------------- |-----------:|---------:|---------:|-------:|------:|------:|----------:|
|  RoundTripBytes |   932.0 ns |  5.09 ns |  4.25 ns | 0.1173 |     - |     - |     368 B |
| RoundTripString | 1,114.8 ns | 22.19 ns | 23.74 ns | 0.1469 |     - |     - |     464 B |
```
@dkanada dkanada merged commit ad203d0 into master Feb 4, 2021
@dkanada dkanada deleted the roundtrip branch February 4, 2021 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants