Utf8Json -> System.Text.Json (#9933)
This commit is contained in:
parent
69a44b5439
commit
3a4e7866d4
|
|
@ -160,7 +160,6 @@ and are generated based on the last package release.
|
||||||
<LatestPackageReference Include="System.Text.Json" Version="$(SystemTextJsonPackageVersion)" />
|
<LatestPackageReference Include="System.Text.Json" Version="$(SystemTextJsonPackageVersion)" />
|
||||||
<LatestPackageReference Include="System.Threading.Channels" Version="$(SystemThreadingChannelsPackageVersion)" />
|
<LatestPackageReference Include="System.Threading.Channels" Version="$(SystemThreadingChannelsPackageVersion)" />
|
||||||
<LatestPackageReference Include="System.Threading.Tasks.Extensions" Version="$(SystemThreadingTasksExtensionsPackageVersion)" />
|
<LatestPackageReference Include="System.Threading.Tasks.Extensions" Version="$(SystemThreadingTasksExtensionsPackageVersion)" />
|
||||||
<LatestPackageReference Include="Utf8Json" Version="$(Utf8JsonPackageVersion)" />
|
|
||||||
<LatestPackageReference Include="xunit.abstractions" Version="$(XunitAbstractionsPackageVersion)" />
|
<LatestPackageReference Include="xunit.abstractions" Version="$(XunitAbstractionsPackageVersion)" />
|
||||||
<LatestPackageReference Include="xunit.analyzers" Version="$(XunitAnalyzersPackageVersion)" />
|
<LatestPackageReference Include="xunit.analyzers" Version="$(XunitAnalyzersPackageVersion)" />
|
||||||
<LatestPackageReference Include="xunit.assert" Version="$(XunitAssertPackageVersion)" />
|
<LatestPackageReference Include="xunit.assert" Version="$(XunitAssertPackageVersion)" />
|
||||||
|
|
|
||||||
|
|
@ -195,7 +195,6 @@
|
||||||
<SerilogSinksFilePackageVersion>4.0.0</SerilogSinksFilePackageVersion>
|
<SerilogSinksFilePackageVersion>4.0.0</SerilogSinksFilePackageVersion>
|
||||||
<StackExchangeRedisPackageVersion>2.0.513</StackExchangeRedisPackageVersion>
|
<StackExchangeRedisPackageVersion>2.0.513</StackExchangeRedisPackageVersion>
|
||||||
<SystemReactiveLinqPackageVersion>3.1.1</SystemReactiveLinqPackageVersion>
|
<SystemReactiveLinqPackageVersion>3.1.1</SystemReactiveLinqPackageVersion>
|
||||||
<Utf8JsonPackageVersion>1.3.7</Utf8JsonPackageVersion>
|
|
||||||
<XunitAbstractionsPackageVersion>2.0.3</XunitAbstractionsPackageVersion>
|
<XunitAbstractionsPackageVersion>2.0.3</XunitAbstractionsPackageVersion>
|
||||||
<XunitAnalyzersPackageVersion>0.10.0</XunitAnalyzersPackageVersion>
|
<XunitAnalyzersPackageVersion>0.10.0</XunitAnalyzersPackageVersion>
|
||||||
<XunitVersion>2.4.1</XunitVersion>
|
<XunitVersion>2.4.1</XunitVersion>
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,9 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.IO.Pipelines;
|
using System.IO.Pipelines;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http;
|
using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http;
|
||||||
using Utf8Json;
|
|
||||||
|
|
||||||
namespace PlatformBenchmarks
|
namespace PlatformBenchmarks
|
||||||
{
|
{
|
||||||
|
|
@ -25,6 +25,8 @@ namespace PlatformBenchmarks
|
||||||
|
|
||||||
private readonly static AsciiString _plainTextBody = "Hello, World!";
|
private readonly static AsciiString _plainTextBody = "Hello, World!";
|
||||||
|
|
||||||
|
private static readonly JsonSerializerOptions SerializerOptions = new JsonSerializerOptions();
|
||||||
|
|
||||||
public static class Paths
|
public static class Paths
|
||||||
{
|
{
|
||||||
public readonly static AsciiString Plaintext = "/plaintext";
|
public readonly static AsciiString Plaintext = "/plaintext";
|
||||||
|
|
@ -115,8 +117,8 @@ namespace PlatformBenchmarks
|
||||||
|
|
||||||
// Content-Length header
|
// Content-Length header
|
||||||
writer.Write(_headerContentLength);
|
writer.Write(_headerContentLength);
|
||||||
var jsonPayload = JsonSerializer.SerializeUnsafe(new { message = "Hello, World!" });
|
var jsonPayload = JsonSerializer.ToBytes(new { message = "Hello, World!" }, SerializerOptions);
|
||||||
writer.WriteNumeric((uint)jsonPayload.Count);
|
writer.WriteNumeric((uint)jsonPayload.Length);
|
||||||
|
|
||||||
// End of headers
|
// End of headers
|
||||||
writer.Write(_eoh);
|
writer.Write(_eoh);
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,6 @@
|
||||||
|
|
||||||
<!-- These references are used when running locally -->
|
<!-- These references are used when running locally -->
|
||||||
<ItemGroup Condition="'$(BenchmarksTargetFramework)' == ''">
|
<ItemGroup Condition="'$(BenchmarksTargetFramework)' == ''">
|
||||||
<Reference Include="Utf8Json" />
|
|
||||||
<Reference Include="Microsoft.AspNetCore.Server.Kestrel" />
|
<Reference Include="Microsoft.AspNetCore.Server.Kestrel" />
|
||||||
<Reference Include="Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv" />
|
<Reference Include="Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv" />
|
||||||
|
|
||||||
|
|
@ -20,7 +19,6 @@
|
||||||
|
|
||||||
<!-- These references are used when running on the Benchmarks Server -->
|
<!-- These references are used when running on the Benchmarks Server -->
|
||||||
<ItemGroup Condition="'$(BenchmarksTargetFramework)' != ''">
|
<ItemGroup Condition="'$(BenchmarksTargetFramework)' != ''">
|
||||||
<PackageReference Include="Utf8Json" Version="1.3.7" />
|
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv" Version="$(MicrosoftAspNetCoreAppPackageVersion)" />
|
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv" Version="$(MicrosoftAspNetCoreAppPackageVersion)" />
|
||||||
|
|
||||||
<FrameworkReference Update="Microsoft.AspNetCore.App" RuntimeFrameworkVersion="$(MicrosoftAspNetCoreAppPackageVersion)" />
|
<FrameworkReference Update="Microsoft.AspNetCore.App" RuntimeFrameworkVersion="$(MicrosoftAspNetCoreAppPackageVersion)" />
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue