From c74c626ec48e35db9a23450efa40f44311775ff2 Mon Sep 17 00:00:00 2001 From: DJGosnell Date: Wed, 29 Nov 2023 18:29:53 -0500 Subject: [PATCH 1/2] Changed to use .net8 Fixed changed preview features in QUIC. Updated benchmarks. --- README.md | 28 +++++++++---------- .../NexNet.Generator.Tests.csproj | 6 ++-- src/NexNet.Generator/NexNet.Generator.csproj | 2 +- .../NexNet.IntegrationTests.csproj | 6 ++-- .../NexusServerTests.cs | 6 +--- src/NexNet.Quic/QuicHelpers.cs | 10 +++---- src/NexNet.props | 4 +-- src/NexNet.sln | 3 +- .../Pipelines/Buffers/BufferWriter.Debug.cs | 6 ++-- src/NexNet/Internals/Pipelines/Helpers.cs | 1 + src/NexNet/NexNet.csproj | 8 ++---- src/NexNetBenchmarks/BenchmarkConfig.cs | 2 +- src/NexNetBenchmarks/NexNetBenchmarks.csproj | 6 ++-- src/NexNetDemo/NexNetDemo.csproj | 2 +- src/tag_release.ps1 | 25 +++++++++++++++++ 15 files changed, 68 insertions(+), 47 deletions(-) create mode 100644 src/tag_release.ps1 diff --git a/README.md b/README.md index 41858c0e..40fbb0a6 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# NexNet [![Action Workflow](https://github.com/Dtronix/NexNet/actions/workflows/dotnet.yml/badge.svg)](https://github.com/Dtronix/NexNet/actions) [![NexNet](https://img.shields.io/nuget/v/NexNet.svg?maxAge=60)](https://www.nuget.org/packages/NexNet) [![NexNet.Generator](https://img.shields.io/nuget/v/NexNet.Generator.svg?maxAge=60)](https://www.nuget.org/packages/NexNet.Generator) [![NexNet.Quic](https://img.shields.io/nuget/v/NexNet.Quic.svg?maxAge=60)](https://www.nuget.org/packages/NexNet.Quic) +# NexNet [![Action Workflow](https://github.com/Dtronix/NexNet/actions/workflows/dotnet.yml/badge.svg)](https://github.com/Dtronix/NexNet/actions) [![NexNet](https://img.shields.io/nuget/v/NexNet.svg?maxAge=60)](https://www.nuget.org/packages/NexNet) [![NexNet.Generator](https://img.shields.io/nuget/v/NexNet.Generator.svg?maxAge=60)](https://www.nuget.org/packages/NexNet.Generator) [![NexNet.Quic](https://img.shields.io/nuget/v/NexNet.Quic.svg?maxAge=60)](https://www.nuget.org/packages/NexNet.Quic) NexNet is a .NET real-time asynchronous networking library, providing developers with the capability to seamlessly incorporate server and client bidirectional event-driven functionality into their applications. This framework streamlines the transmission of updates bidirectionally between server-side code and connected clients with resilient communication channels. @@ -80,23 +80,23 @@ await client.Proxy.UpdateInfoAndWait(1, 2, "Custom Status"); ``` ## Benchmarks ``` -BenchmarkDotNet v0.13.8, Windows 11 (10.0.22621.2283/22H2/2022Update/SunValley2) -AMD Ryzen 9 3900X, 1 CPU, 24 logical and 12 physical cores -.NET SDK 8.0.100-rc.1.23455.8 - [Host] : .NET 7.0.10 (7.0.1023.36312), X64 RyuJIT AVX2 - Job-ASQQIE : .NET 7.0.10 (7.0.1023.36312), X64 RyuJIT AVX2 +BenchmarkDotNet v0.13.10, Windows 11 (10.0.23590.1000) +Intel Core i7-10700 CPU 2.90GHz, 1 CPU, 16 logical and 8 physical cores +.NET SDK 8.0.100 + [Host] : .NET 8.0.0 (8.0.23.53103), X64 RyuJIT AVX2 + Job-JQCICL : .NET 8.0.0 (8.0.23.53103), X64 RyuJIT AVX2 -Platform=X64 Runtime=.NET 7.0 MaxIterationCount=5 +Platform=X64 Runtime=.NET 8.0 MaxIterationCount=5 MaxWarmupIterationCount=3 MinIterationCount=3 MinWarmupIterationCount=1 ``` -| Method | Mean | Error | StdDev | Op/s | Gen0 | Gen1 | Allocated | -|------------------------------------- |---------:|---------:|---------:|---------:|-------:|-------:|----------:| -| InvocationNoArgument | 38.66 us | 2.070 us | 0.537 us | 25,867.9 | 0.0610 | - | 681 B | -| InvocationUnmanagedArgument | 38.35 us | 2.496 us | 0.648 us | 26,078.6 | 0.0610 | - | 737 B | -| InvocationUnmanagedMultipleArguments | 38.98 us | 2.044 us | 0.531 us | 25,654.8 | 0.0610 | - | 785 B | -| InvocationNoArgumentWithResult | 38.22 us | 0.752 us | 0.195 us | 26,166.8 | 0.0610 | - | 721 B | -| InvocationWithDuplexPipe_Upload | 64.48 us | 2.690 us | 0.416 us | 15,509.1 | 2.0752 | 0.4883 | 14142 B | +| Method | Mean | Error | StdDev | Op/s | Gen0 | Gen1| Allocated | +|--------------------------- |---------:|-------:|--------:|-------:|-----:|----:|----------:| +| NoArgument | 38.9 μs | 0.98 μs | 0.25 μs | 25,702 | 0.06 | - | 632 B | +| UnmanagedArgument | 39.8 μs | 1.02 μs | 0.26 μs | 25,110 | 0.06 | - | 689 B | +| UnmanagedMultipleArguments | 38.6 μs | 2.62 μs | 0.40 μs | 25,894 | 0.06 | - | 737 B | +| NoArgumentWithResult | 38.8 μs | 0.89 μs | 0.23 μs | 25,750 | 0.06 | - | 673 B | +| WithDuplexPipe_Upload | 49.6 μs | 2.72 μs | 0.42 μs | 20,138 | 2.07 | 0.4 | 13987 B | ## Method Invocation Table Some methods are handled differently based upon the arguments passed and there are limitations placed upon the types of arguments which can be used together. Most of these incompatibilities handled with Diagnostic Errors provided by the `NexNet.Generator`. Below is a table which shows valid combinations of arguments and return values. diff --git a/src/NexNet.Generator.Tests/NexNet.Generator.Tests.csproj b/src/NexNet.Generator.Tests/NexNet.Generator.Tests.csproj index bd1b2de6..ea7ee6a9 100644 --- a/src/NexNet.Generator.Tests/NexNet.Generator.Tests.csproj +++ b/src/NexNet.Generator.Tests/NexNet.Generator.Tests.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 enable enable false @@ -10,8 +10,8 @@ - - + + diff --git a/src/NexNet.Generator/NexNet.Generator.csproj b/src/NexNet.Generator/NexNet.Generator.csproj index ca2ec47a..5bda42ba 100644 --- a/src/NexNet.Generator/NexNet.Generator.csproj +++ b/src/NexNet.Generator/NexNet.Generator.csproj @@ -23,7 +23,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/NexNet.IntegrationTests/NexNet.IntegrationTests.csproj b/src/NexNet.IntegrationTests/NexNet.IntegrationTests.csproj index f0803b8f..cff84cd7 100644 --- a/src/NexNet.IntegrationTests/NexNet.IntegrationTests.csproj +++ b/src/NexNet.IntegrationTests/NexNet.IntegrationTests.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 enable enable false @@ -16,8 +16,8 @@ - - + + diff --git a/src/NexNet.IntegrationTests/NexusServerTests.cs b/src/NexNet.IntegrationTests/NexusServerTests.cs index 1f964155..0f580277 100644 --- a/src/NexNet.IntegrationTests/NexusServerTests.cs +++ b/src/NexNet.IntegrationTests/NexusServerTests.cs @@ -124,11 +124,7 @@ public async Task ThrowsWhenServerIsAlreadyOpenOnSameTransport(Type type) catch (TransportException e) { // Quic does not return information if a UDP port is already in use or not. - Assert.AreEqual( - e.InnerException is QuicException - ? TransportError.InternalError - : TransportError.AddressInUse, - e.Error); + Assert.AreEqual(TransportError.AddressInUse, e.Error); } catch (Exception e) { diff --git a/src/NexNet.Quic/QuicHelpers.cs b/src/NexNet.Quic/QuicHelpers.cs index 5333db12..66cb42d8 100644 --- a/src/NexNet.Quic/QuicHelpers.cs +++ b/src/NexNet.Quic/QuicHelpers.cs @@ -18,16 +18,16 @@ public static TransportError GetTransportError(QuicError error) QuicError.InternalError => TransportError.InternalError, QuicError.ConnectionAborted => TransportError.ConnectionAborted, QuicError.StreamAborted => TransportError.StreamAborted, - QuicError.AddressInUse => TransportError.AddressInUse, - QuicError.InvalidAddress => TransportError.InvalidAddress, + QuicError.AlpnInUse => TransportError.AddressInUse, QuicError.ConnectionTimeout => TransportError.ConnectionTimeout, - QuicError.HostUnreachable => TransportError.Unreachable, QuicError.ConnectionRefused => TransportError.ConnectionRefused, QuicError.VersionNegotiationError => TransportError.VersionNegotiationError, QuicError.ConnectionIdle => TransportError.ConnectionIdle, - QuicError.ProtocolError => TransportError.ProtocolError, QuicError.OperationAborted => TransportError.OperationAborted, - _ => TransportError.InternalError, + QuicError.Success => TransportError.Success, + QuicError.TransportError => TransportError.ProtocolError, + QuicError.CallbackError => TransportError.InternalError, + _ => TransportError.InternalError }; } } diff --git a/src/NexNet.props b/src/NexNet.props index 0524b626..d235dd77 100644 --- a/src/NexNet.props +++ b/src/NexNet.props @@ -1,9 +1,9 @@ - 0.5.0 + 0.6.0 enable latest - net7.0 + net8.0 true snupkg Dtronix diff --git a/src/NexNet.sln b/src/NexNet.sln index dfe0d575..512e3518 100644 --- a/src/NexNet.sln +++ b/src/NexNet.sln @@ -16,6 +16,7 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "github", "github", "{AFD63E22-F3AE-48D4-91F9-53513F176A46}" ProjectSection(SolutionItems) = preProject ..\.github\workflows\dotnet.yml = ..\.github\workflows\dotnet.yml + ..\README.md = ..\README.md EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NexNet.Quic", "NexNet.Quic\NexNet.Quic.csproj", "{AB75B6D0-0DC0-4E3A-A3A7-320DFB6B09C5}" @@ -25,7 +26,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution NexNet.props = NexNet.props EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NexNetBenchmarks", "NexNetBenchmarks\NexNetBenchmarks.csproj", "{601A50B4-E03D-423F-A1FF-99805719C409}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NexNetBenchmarks", "NexNetBenchmarks\NexNetBenchmarks.csproj", "{601A50B4-E03D-423F-A1FF-99805719C409}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/src/NexNet/Internals/Pipelines/Buffers/BufferWriter.Debug.cs b/src/NexNet/Internals/Pipelines/Buffers/BufferWriter.Debug.cs index 296fada5..388c1a9f 100644 --- a/src/NexNet/Internals/Pipelines/Buffers/BufferWriter.Debug.cs +++ b/src/NexNet/Internals/Pipelines/Buffers/BufferWriter.Debug.cs @@ -8,10 +8,10 @@ partial class BufferWriter internal static int LiveSegmentCount => RefCountedSegment.LiveCount; partial class RefCountedSegment { - static partial void IncrLiveCount() => Interlocked.Increment(ref s_LiveCount); - static partial void DecrLiveCount() => Interlocked.Decrement(ref s_LiveCount); + //static partial void IncrLiveCount() => Interlocked.Increment(ref s_LiveCount); + //static partial void DecrLiveCount() => Interlocked.Decrement(ref s_LiveCount); private static int s_LiveCount; internal static int LiveCount => Volatile.Read(ref s_LiveCount); } } -#endif \ No newline at end of file +#endif diff --git a/src/NexNet/Internals/Pipelines/Helpers.cs b/src/NexNet/Internals/Pipelines/Helpers.cs index b1dbf1ed..99661699 100644 --- a/src/NexNet/Internals/Pipelines/Helpers.cs +++ b/src/NexNet/Internals/Pipelines/Helpers.cs @@ -6,6 +6,7 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Text.RegularExpressions; +using System.Threading; using System.Threading.Tasks; using NexNet.Internals.Pipelines.Internal; diff --git a/src/NexNet/NexNet.csproj b/src/NexNet/NexNet.csproj index 22cb0b90..60d253d9 100644 --- a/src/NexNet/NexNet.csproj +++ b/src/NexNet/NexNet.csproj @@ -1,8 +1,6 @@  - net7.0 - enable $(DefineConstants);SOCKET_STREAM_BUFFERS;RANGES true A real-time asynchronous networking library that provides bidirectional communication between a server and multiple clients. @@ -13,8 +11,8 @@ - - - + + + \ No newline at end of file diff --git a/src/NexNetBenchmarks/BenchmarkConfig.cs b/src/NexNetBenchmarks/BenchmarkConfig.cs index 056f6494..1b664c18 100644 --- a/src/NexNetBenchmarks/BenchmarkConfig.cs +++ b/src/NexNetBenchmarks/BenchmarkConfig.cs @@ -23,7 +23,7 @@ public static IConfig Get() return ManualConfig.CreateEmpty() // Jobs .AddJob(Job.Default - .WithRuntime(CoreRuntime.Core70) + .WithRuntime(CoreRuntime.Core80) .WithPlatform(Platform.X64) .WithMinWarmupCount(1) .WithMaxWarmupCount(3) diff --git a/src/NexNetBenchmarks/NexNetBenchmarks.csproj b/src/NexNetBenchmarks/NexNetBenchmarks.csproj index 7b4ebd6a..a6037127 100644 --- a/src/NexNetBenchmarks/NexNetBenchmarks.csproj +++ b/src/NexNetBenchmarks/NexNetBenchmarks.csproj @@ -1,6 +1,6 @@  - net7.0 + net8.0 Exe @@ -14,8 +14,8 @@ enable - - + + diff --git a/src/NexNetDemo/NexNetDemo.csproj b/src/NexNetDemo/NexNetDemo.csproj index 45ebae09..65366d1c 100644 --- a/src/NexNetDemo/NexNetDemo.csproj +++ b/src/NexNetDemo/NexNetDemo.csproj @@ -2,7 +2,7 @@ Exe - net7.0 + net8.0 enable enable false diff --git a/src/tag_release.ps1 b/src/tag_release.ps1 new file mode 100644 index 00000000..cc508d5c --- /dev/null +++ b/src/tag_release.ps1 @@ -0,0 +1,25 @@ +# Ensure that changes are not pending. +$gitChanges = git status --porcelain; +$ChangedFiles = $($gitChanges | Measure-Object | Select-Object -expand Count) +if ($ChangedFiles -gt 0) +{ + Write-Output "There are $ChangedFiles uncommited changes in the repository. Must commit prior to tagging. Changed Files:" + Write-Output $gitChanges + Read-Host -Prompt "Press Enter to exit" + exit +} + +$projectFile = Get-ChildItem -filter "NexNet.props" +$version = Select-Xml -Path $projectFile -XPath "Project/PropertyGroup/Version" | Select-Object -ExpandProperty Node +$tag = "v" + $version.InnerText + +$confirmation = Read-Host "Tag current commit with '$tag' (y/n):" +if ($confirmation -eq 'y') { + git tag $tag +} + +$confirmation = Read-Host "Push new tag to origin? (y/n):" +if ($confirmation -eq 'y') { + git push origin $tag + git push origin +} \ No newline at end of file From e2d87b0eddd521fbe16fecd826751cf72bc9aa63 Mon Sep 17 00:00:00 2001 From: DJGosnell Date: Wed, 29 Nov 2023 18:31:51 -0500 Subject: [PATCH 2/2] Updated to use .net8 in build pipeline/ --- .github/workflows/dotnet.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index f5eaf67d..40b2bedf 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -27,7 +27,7 @@ jobs: - name: Install .NET uses: actions/setup-dotnet@v3 with: - dotnet-version: 7.0.* + dotnet-version: 8.0.* source-url: https://api.nuget.org/v3/index.json env: NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}