Skip to content

Commit

Permalink
Release 1.9.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
WorkingRobot committed Nov 14, 2023
1 parent 1bdf441 commit 5f33779
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
16 changes: 7 additions & 9 deletions Benchmark/Bench.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
using BenchmarkDotNet.Jobs;
using Craftimizer.Simulator;
using Craftimizer.Solver;
using System.Security.Cryptography;
using System.Text;

namespace Craftimizer.Benchmark;

Expand All @@ -14,12 +12,12 @@ namespace Craftimizer.Benchmark;
[DotTraceDiagnoser]
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() =>
Convert.ToHexString(SHA256.HashData(Encoding.UTF8.GetBytes(Data.ToString()!)));
$"{HashCode.Combine(Data.ToString()!):X8}";
}

private static SimulationInput[] Inputs { get; } = new SimulationInput[] {
Expand Down Expand Up @@ -80,9 +78,9 @@ public override readonly string ToString() =>
})
};

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()
{
Expand All @@ -92,10 +90,10 @@ public override readonly string ToString() =>
};

[ParamsSource(nameof(States))]
public SHAWrapper<SimulationState> State { get; set; }
public HashWrapper<SimulationState> State { get; set; }

[ParamsSource(nameof(Configs))]
public SHAWrapper<SolverConfig> Config { get; set; }
public HashWrapper<SolverConfig> Config { get; set; }

[Benchmark]
public async Task<float> Solve()
Expand Down
2 changes: 1 addition & 1 deletion Craftimizer/Craftimizer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Authors>Asriel Camora</Authors>
<Version>1.9.2.0</Version>
<Version>1.9.3.0</Version>
<PackageProjectUrl>https://github.com/WorkingRobot/craftimizer.git</PackageProjectUrl>
<Configurations>Debug;Release</Configurations>
</PropertyGroup>
Expand Down

1 comment on commit 5f33779

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: 5f33779 Previous: a8c3f34 Ratio
Craftimizer.Benchmark.Bench.Solve(State: 04D778BC, Config: 1DEC692A) 1453607361.5384614 ns (± 17877164.035604123)
Craftimizer.Benchmark.Bench.Solve(State: 04D778BC, Config: 1DEC692A) 1099806650 ns (± 6679598.042000155)
Craftimizer.Benchmark.Bench.Solve(State: A00EB694, Config: 1DEC692A) 1532229600 ns (± 12548676.979836788)
Craftimizer.Benchmark.Bench.Solve(State: A00EB694, Config: 1DEC692A) 1089619906.6666667 ns (± 6021476.101477666)

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.