Browse Source

update (#5156)

* use .net core 3

* Update README.md

* UPDATE

* del .vs
luyikk 5 years ago
parent
commit
3c75484cf2

+ 0 - 1
frameworks/CSharp/zysocket-v/PlatformBenchmarks/DBRaw.cs

@@ -99,7 +99,6 @@ namespace PlatformBenchmarks
             var result = new List<Fortune>();
             var result = new List<Fortune>();
 
 
             using (var db = _dbProviderFactory.CreateConnection())
             using (var db = _dbProviderFactory.CreateConnection())
-
             {
             {
                 db.ConnectionString = _connectionString;
                 db.ConnectionString = _connectionString;
                 await db.OpenAsync();
                 await db.OpenAsync();

+ 6 - 5
frameworks/CSharp/zysocket-v/PlatformBenchmarks/HttpHandler.cs

@@ -69,7 +69,8 @@ namespace PlatformBenchmarks
                 return fiberRw.Flush();
                 return fiberRw.Flush();
             }
             }
 
 
-            await await fiberRw.Sync.Ask(WSend);
+            if (fiberRw.UserToken != null)
+                await await fiberRw.Sync.Ask(WSend);
         }
         }
 
 
         private int AnalysisUrl(ReadOnlySpan<byte> url)
         private int AnalysisUrl(ReadOnlySpan<byte> url)
@@ -83,17 +84,17 @@ namespace PlatformBenchmarks
 
 
         }
         }
 
 
-        public async Task Receive(IFiberRw<HttpToken> fiberRw, Memory<byte> memory_r, Memory<byte> memory_w)
+        public async Task Receive(IFiberRw<HttpToken> fiberRw, Memory<byte> memory_r, WriteBytes write)
         {
         {
             var data = (await fiberRw.ReadLine(memory_r));
             var data = (await fiberRw.ReadLine(memory_r));
-            ReadHander(fiberRw, ref memory_w,ref data);
+            ReadHander(fiberRw,ref data,ref write);
             fiberRw.StreamReadFormat.Position = fiberRw.StreamReadFormat.Length;
             fiberRw.StreamReadFormat.Position = fiberRw.StreamReadFormat.Length;
         }
         }
 
 
 
 
-        private void ReadHander(IFiberRw<HttpToken> fiberRw,ref Memory<byte> memory_w, ref Memory<byte> linedata)
+        private void ReadHander(IFiberRw<HttpToken> fiberRw,ref Memory<byte> linedata,ref WriteBytes write)
         {
         {
-            WriteBytes write = new WriteBytes(fiberRw, ref memory_w);
+            
             var token = fiberRw.UserToken;
             var token = fiberRw.UserToken;
             ReadOnlySpan<byte> line = linedata.Span;
             ReadOnlySpan<byte> line = linedata.Span;
             ReadOnlySpan<byte> url = line;
             ReadOnlySpan<byte> url = line;

+ 6 - 6
frameworks/CSharp/zysocket-v/PlatformBenchmarks/PlatformBenchmarks.csproj

@@ -2,16 +2,16 @@
 
 
   <PropertyGroup>
   <PropertyGroup>
     <OutputType>Exe</OutputType>
     <OutputType>Exe</OutputType>
-    <TargetFramework>netcoreapp2.2</TargetFramework>
+    <TargetFramework>netcoreapp3.0</TargetFramework>
     <ServerGarbageCollection>true</ServerGarbageCollection>
     <ServerGarbageCollection>true</ServerGarbageCollection>
-    <LangVersion>7.2</LangVersion>
+    <LangVersion>8.0</LangVersion>
   </PropertyGroup>
   </PropertyGroup>
 
 
   <ItemGroup>
   <ItemGroup>
-    <PackageReference Include="Microsoft.Extensions.Hosting" Version="2.2.0" />
-    <PackageReference Include="Npgsql" Version="4.0.10" />
-    <PackageReference Include="SpanJson" Version="2.0.14" />
-    <PackageReference Include="ZYSocketServerV" Version="1.5.7" />
+    <PackageReference Include="Microsoft.Extensions.Hosting" Version="3.0.0" />
+    <PackageReference Include="Npgsql" Version="4.1.1" />
+    <PackageReference Include="Swifter.Json" Version="1.2.9.6" />
+    <PackageReference Include="ZYSocketServerV" Version="1.6.2" />
   </ItemGroup>
   </ItemGroup>
 
 
 </Project>
 </Project>

+ 9 - 11
frameworks/CSharp/zysocket-v/PlatformBenchmarks/ZYHttpServer.cs

@@ -70,22 +70,20 @@ namespace PlatformBenchmarks
             var fiberRw = await socketAsync.GetFiberRw<HttpToken>();
             var fiberRw = await socketAsync.GetFiberRw<HttpToken>();
             fiberRw.UserToken = new HttpToken
             fiberRw.UserToken = new HttpToken
             {
             {
-                Db= new RawDb(new ConcurrentRandom(), Npgsql.NpgsqlFactory.Instance)
+                Db = new RawDb(new ConcurrentRandom(), Npgsql.NpgsqlFactory.Instance)
             };
             };
-            
-           
 
 
-            using (var data_r = fiberRw.GetMemory(4096))
-            using (var data_w = fiberRw.GetMemory(16384))
-            {
 
 
-                for (; ; )
-                {
-                    await HttpHandler.Receive(fiberRw, data_r.Memory, data_w.Memory);
-                }
 
 
+            using var data_r = fiberRw.GetMemory(4096);
+            using var write = new WriteBytes(fiberRw);
+            for (; ; )
+            {
+                await HttpHandler.Receive(fiberRw, data_r.Memory, write);
             }
             }
-            
+
+
+
         }
         }
     }
     }
 }
 }

+ 3 - 2
frameworks/CSharp/zysocket-v/PlatformBenchmarks/db.cs

@@ -1,4 +1,5 @@
-using SpanJson;
+
+using Swifter.Json;
 using System;
 using System;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 using ZYSocket;
 using ZYSocket;
@@ -14,7 +15,7 @@ namespace PlatformBenchmarks
             try
             try
             {
             {
                 var data = await fiberRw.UserToken.Db.LoadSingleQueryRow();
                 var data = await fiberRw.UserToken.Db.LoadSingleQueryRow();
-                await JsonSerializer.NonGeneric.Utf8.SerializeAsync(data, write.Stream);
+                await JsonFormatter.SerializeObjectAsync(data, write.Stream, System.Text.Encoding.UTF8);
             }
             }
             catch (Exception e_)
             catch (Exception e_)
             {
             {

+ 2 - 3
frameworks/CSharp/zysocket-v/PlatformBenchmarks/fortunes.cs

@@ -43,13 +43,12 @@ namespace PlatformBenchmarks
                     write.Flush(false);
                     write.Flush(false);
                     return fiberRw.Flush();
                     return fiberRw.Flush();
                 }
                 }
-
-                await await fiberRw.Sync.Ask(WSend);
+                if (fiberRw.UserToken != null)
+                    await await fiberRw.Sync.Ask(WSend);
             }
             }
             catch (Exception e_)
             catch (Exception e_)
             {
             {
                 write.Write(e_.Message);
                 write.Write(e_.Message);
-
                 OnCompleted(fiberRw, write);
                 OnCompleted(fiberRw, write);
             }
             }
 
 

+ 3 - 3
frameworks/CSharp/zysocket-v/PlatformBenchmarks/json.cs

@@ -1,4 +1,4 @@
-using SpanJson;
+using Swifter.Json;
 using System;
 using System;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 using ZYSocket;
 using ZYSocket;
@@ -11,8 +11,8 @@ namespace PlatformBenchmarks
         public void Json(IFiberRw<HttpToken> fiberRw,ref WriteBytes write)
         public void Json(IFiberRw<HttpToken> fiberRw,ref WriteBytes write)
         {
         {
             JsonMessage jsonMessage = default(JsonMessage);
             JsonMessage jsonMessage = default(JsonMessage);
-            jsonMessage.message = "Hello, World!";
-            JsonSerializer.NonGeneric.Utf8.SerializeAsync(jsonMessage, write.Stream);
+            jsonMessage.message = "Hello, World!";          
+             JsonFormatter.SerializeObject(jsonMessage,write.Stream,System.Text.Encoding.UTF8);
             OnCompleted(fiberRw, write);
             OnCompleted(fiberRw, write);
         }
         }
     }
     }

+ 4 - 3
frameworks/CSharp/zysocket-v/PlatformBenchmarks/queries.cs

@@ -1,4 +1,4 @@
-using SpanJson;
+using Swifter.Json;
 using System;
 using System;
 using ZYSocket;
 using ZYSocket;
 using ZYSocket.FiberStream;
 using ZYSocket.FiberStream;
@@ -27,8 +27,9 @@ namespace PlatformBenchmarks
                 count = 1;
                 count = 1;
             try
             try
             {
             {
-                var data = await fiberRw.UserToken.Db.LoadMultipleQueriesRows(count);
-                await JsonSerializer.NonGeneric.Utf8.SerializeAsync(data, write.Stream);
+                var data = await fiberRw.UserToken.Db.LoadMultipleQueriesRows(count);               
+
+                await JsonFormatter.SerializeObjectAsync(data, write.Stream, System.Text.Encoding.UTF8);
             }
             }
             catch (Exception e_)
             catch (Exception e_)
             {
             {

+ 1 - 1
frameworks/CSharp/zysocket-v/README.md

@@ -1,4 +1,4 @@
-# [ZYSOCKET-V](ZYSOCKET-V](https://github.com/luyikk/zysocket-v)(.Net) Benchmarking Test
+# [ZYSOCKET-V](https://github.com/luyikk/zysocket-v)(.Net) Benchmarking Test
 This includes tests for plaintext, json, db.
 This includes tests for plaintext, json, db.
 
 
 ## Infrastructure Software Versions
 ## Infrastructure Software Versions

+ 2 - 2
frameworks/CSharp/zysocket-v/zysocket-v.dockerfile

@@ -1,9 +1,9 @@
-FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS build
+FROM mcr.microsoft.com/dotnet/core/sdk:3.0 AS build
 WORKDIR /app
 WORKDIR /app
 COPY PlatformBenchmarks .
 COPY PlatformBenchmarks .
 RUN dotnet publish -c Release -o out
 RUN dotnet publish -c Release -o out
 
 
-FROM mcr.microsoft.com/dotnet/core/aspnet:2.2 AS runtime
+FROM mcr.microsoft.com/dotnet/core/aspnet:3.0 AS runtime
 ENV COMPlus_ReadyToRun 0
 ENV COMPlus_ReadyToRun 0
 WORKDIR /app
 WORKDIR /app
 COPY --from=build /app/out ./
 COPY --from=build /app/out ./

+ 17 - 0
frameworks/FSharp/suave/src/App/obj/x86/Debug/netcoreapp2.1/App.AssemblyInfo.fs

@@ -0,0 +1,17 @@
+// <auto-generated>
+//     Generated by the FSharp WriteCodeFragment class.
+// </auto-generated>
+namespace FSharp
+
+open System
+open System.Reflection
+
+
+[<assembly: System.Reflection.AssemblyCompanyAttribute("App")>]
+[<assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")>]
+[<assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")>]
+[<assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")>]
+[<assembly: System.Reflection.AssemblyProductAttribute("App")>]
+[<assembly: System.Reflection.AssemblyTitleAttribute("App")>]
+[<assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")>]
+do()

+ 1 - 0
frameworks/FSharp/suave/src/App/obj/x86/Debug/netcoreapp2.1/App.AssemblyInfoInputs.cache

@@ -0,0 +1 @@
+935fc6b03c2183b74aad9f70355d701aca07a4a5

+ 1 - 0
frameworks/FSharp/suave/src/App/obj/x86/Debug/netcoreapp2.1/App.fsproj.CoreCompileInputs.cache

@@ -0,0 +1 @@
+996161b50654b5313def748bcba68f19230ee197

+ 17 - 0
frameworks/FSharp/suave/src/App/obj/x86/Release/netcoreapp2.1/App.AssemblyInfo.fs

@@ -0,0 +1,17 @@
+// <auto-generated>
+//     Generated by the FSharp WriteCodeFragment class.
+// </auto-generated>
+namespace FSharp
+
+open System
+open System.Reflection
+
+
+[<assembly: System.Reflection.AssemblyCompanyAttribute("App")>]
+[<assembly: System.Reflection.AssemblyConfigurationAttribute("Release")>]
+[<assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")>]
+[<assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")>]
+[<assembly: System.Reflection.AssemblyProductAttribute("App")>]
+[<assembly: System.Reflection.AssemblyTitleAttribute("App")>]
+[<assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")>]
+do()

+ 1 - 0
frameworks/FSharp/suave/src/App/obj/x86/Release/netcoreapp2.1/App.AssemblyInfoInputs.cache

@@ -0,0 +1 @@
+e00334bb3b31d675bce4978abd5874586e50ef72

+ 1 - 0
frameworks/FSharp/suave/src/App/obj/x86/Release/netcoreapp2.1/App.fsproj.CoreCompileInputs.cache

@@ -0,0 +1 @@
+813325372d046d9e3a38020b82a801095c97816c