浏览代码

update beetlex to 1.4.9 (#4825)

* Update Benchmarks.csproj

update beetlex to 1.4.9

* Update Program.cs

update beetlex 1.4.9

* Update Program.cs

enabled io queue
Henry 6 年之前
父节点
当前提交
87262e3514

+ 2 - 2
frameworks/CSharp/beetlex/Benchmarks/Benchmarks.csproj

@@ -2,12 +2,12 @@
 
   <PropertyGroup>
     <OutputType>Exe</OutputType>
-    <TargetFramework>netcoreapp2.1</TargetFramework>
+    <TargetFramework>netcoreapp2.2</TargetFramework>
     <ServerGarbageCollection>true</ServerGarbageCollection>
   </PropertyGroup>
 
   <ItemGroup>
-    <PackageReference Include="BeetleX.FastHttpApi" Version="1.4.7" />
+    <PackageReference Include="BeetleX.FastHttpApi" Version="1.4.9" />
     <PackageReference Include="Microsoft.Extensions.Hosting" Version="2.1.1" />
     <PackageReference Include="SpanJson" Version="2.0.10" />
   </ItemGroup>

+ 4 - 7
frameworks/CSharp/beetlex/Benchmarks/Program.cs

@@ -10,7 +10,7 @@ using SpanJson;
 
 namespace Benchmarks
 {
-    [BeetleX.FastHttpApi.Controller]
+    [Controller]
     class Program
     {
         private static readonly byte[] _helloWorldPayload = Encoding.UTF8.GetBytes("Hello, World!");
@@ -52,17 +52,13 @@ namespace Benchmarks
 
         public object Data { get; set; }
 
-        public override string ContentType => "application/json";
+        public override IHeaderItem ContentType => ContentTypes.JSON;
 
         public override bool HasBody => true;
 
         public override void Write(PipeStream stream, HttpResponse response)
         {
-            using (stream.LockFree())
-            {
-                var task = JsonSerializer.NonGeneric.Utf8.SerializeAsync(Data, stream).AsTask();
-                task.Wait();
-            }
+            JsonSerializer.NonGeneric.Utf8.SerializeAsync(Data, stream);
         }
     }
 
@@ -81,6 +77,7 @@ namespace Benchmarks
             mApiServer.Options.UrlIgnoreCase = false;
             mApiServer.Options.LogLevel = BeetleX.EventArgs.LogType.Off;
             mApiServer.Options.LogToConsole = true;
+            mApiServer.Options.IOQueueEnabled = true;
             mApiServer.Open();
             Console.WriteLine("BeetleX FastHttpApi server");
             Console.WriteLine($"ServerGC:{System.Runtime.GCSettings.IsServerGC}");