Release 1.9.3.0

This commit is contained in:
Asriel Camora
2023-11-14 02:59:58 -08:00
parent 1bdf4412c8
commit 5f33779409
2 changed files with 8 additions and 10 deletions
+7 -9
View File
@@ -3,8 +3,6 @@ using BenchmarkDotNet.Diagnostics.dotTrace;
using BenchmarkDotNet.Jobs; using BenchmarkDotNet.Jobs;
using Craftimizer.Simulator; using Craftimizer.Simulator;
using Craftimizer.Solver; using Craftimizer.Solver;
using System.Security.Cryptography;
using System.Text;
namespace Craftimizer.Benchmark; namespace Craftimizer.Benchmark;
@@ -14,12 +12,12 @@ namespace Craftimizer.Benchmark;
[DotTraceDiagnoser] [DotTraceDiagnoser]
public class Bench public class Bench
{ {
public record struct SHAWrapper<T>(T Data) where T : notnull public record struct HashWrapper<T>(T Data) where T : notnull
{ {
public static implicit operator T(SHAWrapper<T> wrapper) => wrapper.Data; public static implicit operator T(HashWrapper<T> wrapper) => wrapper.Data;
public override readonly string ToString() => public override readonly string ToString() =>
Convert.ToHexString(SHA256.HashData(Encoding.UTF8.GetBytes(Data.ToString()!))); $"{HashCode.Combine(Data.ToString()!):X8}";
} }
private static SimulationInput[] Inputs { get; } = new SimulationInput[] { private static SimulationInput[] Inputs { get; } = new SimulationInput[] {
@@ -80,9 +78,9 @@ public class Bench
}) })
}; };
public static IEnumerable<SHAWrapper<SimulationState>> States => Inputs.Select(i => new SHAWrapper<SimulationState>(new(i))); public static IEnumerable<HashWrapper<SimulationState>> States => Inputs.Select(i => new HashWrapper<SimulationState>(new(i)));
public static IEnumerable<SHAWrapper<SolverConfig>> Configs => new SHAWrapper<SolverConfig>[] public static IEnumerable<HashWrapper<SolverConfig>> Configs => new HashWrapper<SolverConfig>[]
{ {
new(new() new(new()
{ {
@@ -92,10 +90,10 @@ public class Bench
}; };
[ParamsSource(nameof(States))] [ParamsSource(nameof(States))]
public SHAWrapper<SimulationState> State { get; set; } public HashWrapper<SimulationState> State { get; set; }
[ParamsSource(nameof(Configs))] [ParamsSource(nameof(Configs))]
public SHAWrapper<SolverConfig> Config { get; set; } public HashWrapper<SolverConfig> Config { get; set; }
[Benchmark] [Benchmark]
public async Task<float> Solve() public async Task<float> Solve()
+1 -1
View File
@@ -2,7 +2,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<Authors>Asriel Camora</Authors> <Authors>Asriel Camora</Authors>
<Version>1.9.2.0</Version> <Version>1.9.3.0</Version>
<PackageProjectUrl>https://github.com/WorkingRobot/craftimizer.git</PackageProjectUrl> <PackageProjectUrl>https://github.com/WorkingRobot/craftimizer.git</PackageProjectUrl>
<Configurations>Debug;Release</Configurations> <Configurations>Debug;Release</Configurations>
</PropertyGroup> </PropertyGroup>