From 0d2d8acadbbf4bb973ff4e2b0e391e68669a9aab Mon Sep 17 00:00:00 2001 From: "SmallChi(Koike)" <564952747@qq.com> Date: Tue, 17 Nov 2020 09:37:16 +0800 Subject: [PATCH 1/3] Update dotnetcore.yml --- .github/workflows/dotnetcore.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dotnetcore.yml b/.github/workflows/dotnetcore.yml index c1f9750..becb70f 100755 --- a/.github/workflows/dotnetcore.yml +++ b/.github/workflows/dotnetcore.yml @@ -12,7 +12,7 @@ jobs: - name: Setup .NET Core uses: actions/setup-dotnet@master with: - dotnet-version: 3.1.403 + dotnet-version: 5.0.100 - name: dotnet info run: dotnet --info - name: dotnet restore From a725d6bac6b881634d4d05368728ca971af50dc7 Mon Sep 17 00:00:00 2001 From: "SmallChi(Koike)" <564952747@qq.com> Date: Tue, 17 Nov 2020 10:21:25 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=8D=87=E7=BA=A7net5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../JT808.Protocol.Benchmark.csproj | 2 +- .../JT808SerializerContext.cs | 3 +- .../JT808.Protocol.Test.csproj | 10 ++-- .../Extensions/JT808HexExtensions.cs | 2 +- src/JT808.Protocol/JT808.Protocol.csproj | 49 ++++++++----------- 5 files changed, 30 insertions(+), 36 deletions(-) diff --git a/src/JT808.Protocol.Benchmark/JT808.Protocol.Benchmark.csproj b/src/JT808.Protocol.Benchmark/JT808.Protocol.Benchmark.csproj index 834630b..e9dfa40 100644 --- a/src/JT808.Protocol.Benchmark/JT808.Protocol.Benchmark.csproj +++ b/src/JT808.Protocol.Benchmark/JT808.Protocol.Benchmark.csproj @@ -1,7 +1,7 @@  - netcoreapp3.1 + net5 true AnyCPU Exe diff --git a/src/JT808.Protocol.Benchmark/JT808SerializerContext.cs b/src/JT808.Protocol.Benchmark/JT808SerializerContext.cs index 05cca5e..8773d40 100644 --- a/src/JT808.Protocol.Benchmark/JT808SerializerContext.cs +++ b/src/JT808.Protocol.Benchmark/JT808SerializerContext.cs @@ -164,7 +164,8 @@ namespace JT808.Protocol.Benchmark { public JT808SerializerConfig() { - Add(Job.Default.WithGcServer(false).With(CsProjCoreToolchain.NetCoreApp31).With(Platform.AnyCpu)); + AddJob(Job.Default.WithGcServer(false).WithToolchain(CsProjCoreToolchain.NetCoreApp50).WithPlatform(Platform.AnyCpu)); + AddJob(Job.Default.WithGcServer(false).WithToolchain(CsProjCoreToolchain.NetCoreApp31).WithPlatform(Platform.AnyCpu)); } } } diff --git a/src/JT808.Protocol.Test/JT808.Protocol.Test.csproj b/src/JT808.Protocol.Test/JT808.Protocol.Test.csproj index c764558..8391e48 100644 --- a/src/JT808.Protocol.Test/JT808.Protocol.Test.csproj +++ b/src/JT808.Protocol.Test/JT808.Protocol.Test.csproj @@ -1,7 +1,7 @@  - netcoreapp3.1 + net5 false 8.0 @@ -107,15 +107,15 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + - - + + diff --git a/src/JT808.Protocol/Extensions/JT808HexExtensions.cs b/src/JT808.Protocol/Extensions/JT808HexExtensions.cs index 055e494..6d10953 100644 --- a/src/JT808.Protocol/Extensions/JT808HexExtensions.cs +++ b/src/JT808.Protocol/Extensions/JT808HexExtensions.cs @@ -65,7 +65,7 @@ namespace JT808.Protocol.Extensions public static string ReadHexStringLittle(ReadOnlySpan read, ref int offset, int len) { - ReadOnlySpan source = read.Slice(offset, len); + //ReadOnlySpan source = read.Slice(offset, len); string hex = HexUtil.DoHexDump(read, offset, len); offset += len; return hex; diff --git a/src/JT808.Protocol/JT808.Protocol.csproj b/src/JT808.Protocol/JT808.Protocol.csproj index 556fc4a..8d72c62 100644 --- a/src/JT808.Protocol/JT808.Protocol.csproj +++ b/src/JT808.Protocol/JT808.Protocol.csproj @@ -1,7 +1,7 @@  - netstandard2.0;netstandard2.1; - 8.0 + netstandard2.0;netstandard2.1;net5; + 9.0 Copyright 2018. SmallChi JT808 @@ -13,27 +13,12 @@ https://github.com/SmallChi/JT808 https://github.com/SmallChi/JT808/blob/master/LICENSE https://github.com/SmallChi/JT808/blob/master/LICENSE + JT808.Protocol.xml false - 2.2.14 + 2.3.0 LICENSE - - $(OutputPath)$(MSBuildProjectName).xml - true - - - true - - - $(OutputPath)$(MSBuildProjectName).xml - - 1701;1702;CS1591;CS1572;CS1573;CS1574;CS1570; - - - $(OutputPath)$(MSBuildProjectName).xml - - 1701;1702;CS1591;CS1572;CS1573;CS1574;CS1570; - + @@ -67,30 +52,38 @@ + + + + + + + + + + - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - + + - + TextTemplatingFileGenerator JT808PackageExtensionsTemplate.cs - + - + True From 8df014e60143d3df4df7983ebc9ddd7175350e77 Mon Sep 17 00:00:00 2001 From: "SmallChi(Koike)" <564952747@qq.com> Date: Tue, 17 Nov 2020 11:25:38 +0800 Subject: [PATCH 3/3] =?UTF-8?q?v2.3.0=20=E5=8D=87=E7=BA=A7net5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 38 +++++++++---------- .../JT808SerializerContext.cs | 1 - 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index fa94878..77c6509 100644 --- a/README.md +++ b/README.md @@ -302,28 +302,28 @@ JT808Serializer DT2JT808Serializer = new JT808Serializer(DT2JT808Config); BenchmarkDotNet=v0.12.1, OS=Windows 10.0.19041.572 (2004/?/20H1) Intel Core i7-8700K CPU 3.70GHz (Coffee Lake), 1 CPU, 12 logical and 6 physical cores -.NET Core SDK=3.1.403 - [Host] : .NET Core 3.1.9 (CoreCLR 4.700.20.47201, CoreFX 4.700.20.47203), X64 RyuJIT - Job-ZFMIVI : .NET Core 3.1.9 (CoreCLR 4.700.20.47201, CoreFX 4.700.20.47203), X64 RyuJIT +.NET Core SDK=5.0.100 + [Host] : .NET Core 5.0.0 (CoreCLR 5.0.20.51904, CoreFX 5.0.20.51904), X64 RyuJIT + Job-WADLYX : .NET Core 5.0.0 (CoreCLR 5.0.20.51904, CoreFX 5.0.20.51904), X64 RyuJIT -Platform=AnyCpu Server=False Toolchain=.NET Core 3.1 +Platform=AnyCpu Server=False Toolchain=.NET Core 5.0 ``` -| Method | Categories | N | Mean | Error | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated | -|-------------------------------- |----------------- |------- |--------------:|-------------:|-------------:|-----------:|------:|------:|-------------:| -| **0x0200_All_AttachId_Serialize** | **0x0200Serializer** | **100** | **277.49 μs** | **2.517 μs** | **2.355 μs** | **31.7383** | **-** | **-** | **196.1 KB** | -| 0x0200_All_AttachId_Deserialize | 0x0200Serializer | 100 | 829.22 μs | 9.635 μs | 9.012 μs | 80.0781 | - | - | 493.75 KB | -| **0x0200_All_AttachId_Serialize** | **0x0200Serializer** | **10000** | **26,984.85 μs** | **231.925 μs** | **216.943 μs** | **3187.5000** | **-** | **-** | **19609.38 KB** | -| 0x0200_All_AttachId_Deserialize | 0x0200Serializer | 10000 | 82,945.39 μs | 514.580 μs | 456.162 μs | 8000.0000 | - | - | 49375.21 KB | -| **0x0200_All_AttachId_Serialize** | **0x0200Serializer** | **100000** | **270,868.40 μs** | **2,424.798 μs** | **2,268.158 μs** | **32000.0000** | **-** | **-** | **196093.75 KB** | -| 0x0200_All_AttachId_Deserialize | 0x0200Serializer | 100000 | 820,168.63 μs | 7,354.224 μs | 6,879.145 μs | 80000.0000 | - | - | 493750 KB | -| | | | | | | | | | | -| **0x0100Serialize** | **0x0100Serializer** | **100** | **86.25 μs** | **1.057 μs** | **0.825 μs** | **10.7422** | **-** | **-** | **66.41 KB** | -| 0x0100Deserialize | 0x0100Serializer | 100 | 79.51 μs | 0.849 μs | 0.753 μs | 15.7471 | - | - | 96.88 KB | -| **0x0100Serialize** | **0x0100Serializer** | **10000** | **8,955.07 μs** | **99.754 μs** | **93.310 μs** | **1078.1250** | **-** | **-** | **6640.71 KB** | -| 0x0100Deserialize | 0x0100Serializer | 10000 | 7,844.03 μs | 90.418 μs | 75.503 μs | 1578.1250 | - | - | 9687.58 KB | -| **0x0100Serialize** | **0x0100Serializer** | **100000** | **90,456.92 μs** | **1,200.062 μs** | **1,122.539 μs** | **10833.3333** | **-** | **-** | **66407.72 KB** | -| 0x0100Deserialize | 0x0100Serializer | 100000 | 80,086.99 μs | 1,110.513 μs | 984.441 μs | 15714.2857 | - | - | 96875 KB | +| Method | Categories | N | Mean | Error | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated | +|-------------------------------- |----------------- |------- |--------------:|--------------:|-------------:|-----------:|------:|------:|-------------:| +| **0x0200_All_AttachId_Serialize** | **0x0200Serializer** | **100** | **249.02 μs** | **3.466 μs** | **2.894 μs** | **31.7383** | **-** | **-** | **196.88 KB** | +| 0x0200_All_AttachId_Deserialize | 0x0200Serializer | 100 | 762.07 μs | 14.713 μs | 15.743 μs | 80.0781 | - | - | 496.09 KB | +| **0x0200_All_AttachId_Serialize** | **0x0200Serializer** | **10000** | **24,541.76 μs** | **173.184 μs** | **161.996 μs** | **3187.5000** | **-** | **-** | **19687.5 KB** | +| 0x0200_All_AttachId_Deserialize | 0x0200Serializer | 10000 | 75,919.55 μs | 1,326.444 μs | 1,175.858 μs | 8000.0000 | - | - | 49609.55 KB | +| **0x0200_All_AttachId_Serialize** | **0x0200Serializer** | **100000** | **249,887.82 μs** | **4,966.928 μs** | **5,520.727 μs** | **32000.0000** | **-** | **-** | **196876.26 KB** | +| 0x0200_All_AttachId_Deserialize | 0x0200Serializer | 100000 | 734,062.09 μs | 10,270.434 μs | 9,104.472 μs | 80000.0000 | - | - | 496095 KB | +| | | | | | | | | | | +| **0x0100Serialize** | **0x0100Serializer** | **100** | **79.16 μs** | **0.906 μs** | **0.803 μs** | **10.7422** | **-** | **-** | **66.41 KB** | +| 0x0100Deserialize | 0x0100Serializer | 100 | 70.47 μs | 1.377 μs | 2.060 μs | 15.7471 | - | - | 96.88 KB | +| **0x0100Serialize** | **0x0100Serializer** | **10000** | **7,934.91 μs** | **121.485 μs** | **113.637 μs** | **1078.1250** | **-** | **-** | **6640.63 KB** | +| 0x0100Deserialize | 0x0100Serializer | 10000 | 7,077.60 μs | 139.419 μs | 165.969 μs | 1578.1250 | - | - | 9687.5 KB | +| **0x0100Serialize** | **0x0100Serializer** | **100000** | **80,403.44 μs** | **1,522.446 μs** | **1,563.440 μs** | **10714.2857** | **-** | **-** | **66406.25 KB** | +| 0x0100Deserialize | 0x0100Serializer | 100000 | 69,196.07 μs | 1,289.555 μs | 1,206.251 μs | 15666.6667 | - | - | 96875.13 KB | ## JT808终端通讯协议消息对照表 diff --git a/src/JT808.Protocol.Benchmark/JT808SerializerContext.cs b/src/JT808.Protocol.Benchmark/JT808SerializerContext.cs index 8773d40..821fc9b 100644 --- a/src/JT808.Protocol.Benchmark/JT808SerializerContext.cs +++ b/src/JT808.Protocol.Benchmark/JT808SerializerContext.cs @@ -165,7 +165,6 @@ namespace JT808.Protocol.Benchmark public JT808SerializerConfig() { AddJob(Job.Default.WithGcServer(false).WithToolchain(CsProjCoreToolchain.NetCoreApp50).WithPlatform(Platform.AnyCpu)); - AddJob(Job.Default.WithGcServer(false).WithToolchain(CsProjCoreToolchain.NetCoreApp31).WithPlatform(Platform.AnyCpu)); } } }