From 5a403ad91c777a6fb130bea64f3c80bed8b8994e Mon Sep 17 00:00:00 2001 From: Boring3 <16686147+Nyrest@users.noreply.github.com> Date: Wed, 14 Aug 2024 21:22:39 +0800 Subject: [PATCH] Upgrade to net8.0 --- .../FastGenericNew.Benchmarks.csproj | 8 +++---- src/FastGenericNew.Benchmarks/Program.cs | 21 +++++++------------ .../Units/ImplementationsBenchmark.cs | 4 ++-- .../Units/ImplementationsInitBenchmark.cs | 2 +- src/FastGenericNew/FastGenericNew.csproj | 8 +++---- 5 files changed, 19 insertions(+), 24 deletions(-) diff --git a/src/FastGenericNew.Benchmarks/FastGenericNew.Benchmarks.csproj b/src/FastGenericNew.Benchmarks/FastGenericNew.Benchmarks.csproj index 4f8a0a1..03ea0d5 100644 --- a/src/FastGenericNew.Benchmarks/FastGenericNew.Benchmarks.csproj +++ b/src/FastGenericNew.Benchmarks/FastGenericNew.Benchmarks.csproj @@ -1,9 +1,9 @@ - + Exe - net6.0;net5.0 - $(TargetFrameworks);net48 + net6.0;net8.0 + $(TargetFrameworks);net461;net48 enable enable 10 @@ -24,7 +24,7 @@ - + diff --git a/src/FastGenericNew.Benchmarks/Program.cs b/src/FastGenericNew.Benchmarks/Program.cs index acf7e21..432e489 100644 --- a/src/FastGenericNew.Benchmarks/Program.cs +++ b/src/FastGenericNew.Benchmarks/Program.cs @@ -1,23 +1,18 @@ // See https://aka.ms/new-console-template for more information using BenchmarkDotNet.Configs; -using BenchmarkDotNet.ConsoleArguments.ListBenchmarks; using BenchmarkDotNet.Diagnosers; using BenchmarkDotNet.Environments; -using FastGenericNew; -using FastGenericNew.Benchmarks; -using FastGenericNew.Benchmarks.Units; - ManualConfig config = ManualConfig.Create(DefaultConfig.Instance); config.AddJob( - //Job.Default.WithRuntime(ClrRuntime.Net48), - //Job.Default.WithRuntime(CoreRuntime.Core50), - Job.Default.WithRuntime(CoreRuntime.Core60)); + Job.Default.WithRuntime(ClrRuntime.Net461), + Job.Default.WithRuntime(ClrRuntime.Net48), + Job.Default.WithRuntime(CoreRuntime.Core31), + Job.Default.WithRuntime(CoreRuntime.Core60), + Job.Default.WithRuntime(CoreRuntime.Core80), + Job.Default.WithRuntime(CoreRuntime.Core90) +); config.AddDiagnoser(MemoryDiagnoser.Default); -//BenchmarkRunner.Run(Assembly.GetCallingAssembly(), config); -#if NET6_0_OR_GREATER -BenchmarkRunner.Run(config); - -#endif \ No newline at end of file +BenchmarkRunner.Run(Assembly.GetCallingAssembly(), config); \ No newline at end of file diff --git a/src/FastGenericNew.Benchmarks/Units/ImplementationsBenchmark.cs b/src/FastGenericNew.Benchmarks/Units/ImplementationsBenchmark.cs index bee8af8..5fd5697 100644 --- a/src/FastGenericNew.Benchmarks/Units/ImplementationsBenchmark.cs +++ b/src/FastGenericNew.Benchmarks/Units/ImplementationsBenchmark.cs @@ -1,14 +1,13 @@ namespace FastGenericNew.Benchmarks.Units; +#if NET6_0_OR_GREATER && FastNew_AllowUnsafeImplementation public class ImplementationsBenchmark { -#if NET6_0_OR_GREATER [Benchmark] public DemoClass ClrNew() { return ClrAllocator.CreateInstance(); } -#endif [Benchmark] public DemoClass FastNew() @@ -22,3 +21,4 @@ public DemoClass Activator() return System.Activator.CreateInstance(); } } +#endif diff --git a/src/FastGenericNew.Benchmarks/Units/ImplementationsInitBenchmark.cs b/src/FastGenericNew.Benchmarks/Units/ImplementationsInitBenchmark.cs index 2a9197d..1ecf7c4 100644 --- a/src/FastGenericNew.Benchmarks/Units/ImplementationsInitBenchmark.cs +++ b/src/FastGenericNew.Benchmarks/Units/ImplementationsInitBenchmark.cs @@ -3,7 +3,7 @@ namespace FastGenericNew.Benchmarks.Units; -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER && FastNew_AllowUnsafeImplementation public unsafe class ImplementationsInitBenchmark { public static readonly delegate* managed clrNew = typeof(ClrAllocator).GetStaticCtor(); diff --git a/src/FastGenericNew/FastGenericNew.csproj b/src/FastGenericNew/FastGenericNew.csproj index 27dfcf8..68619c0 100644 --- a/src/FastGenericNew/FastGenericNew.csproj +++ b/src/FastGenericNew/FastGenericNew.csproj @@ -2,8 +2,8 @@ - net6.0;netstandard2.0;netstandard2.1;net5.0 - $(TargetFrameworks);net461 + netstandard2.0;netstandard2.1;net6.0;net8.0 + $(TargetFrameworks);net461;net48 9.0 disabled enable @@ -11,7 +11,7 @@ true _generated true - true + true @@ -45,7 +45,7 @@ - +