-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
141 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using BenchmarkDotNet.Configs; | ||
using BenchmarkDotNet.Diagnosers; | ||
using BenchmarkDotNet.Environments; | ||
using BenchmarkDotNet.Exporters; | ||
using BenchmarkDotNet.Jobs; | ||
using BenchmarkDotNet.Loggers; | ||
|
||
namespace D2SLib_Benchmark; | ||
|
||
internal class BenchmarkConfig : ManualConfig | ||
{ | ||
public BenchmarkConfig() | ||
{ | ||
AddJob(Job.Default | ||
.WithRuntime(CoreRuntime.Core60) | ||
.WithPlatform(Platform.X64) | ||
.WithJit(Jit.RyuJit)); | ||
AddJob(Job.Default | ||
.WithRuntime(CoreRuntime.Core31) | ||
.WithPlatform(Platform.X64) | ||
.WithJit(Jit.RyuJit)); | ||
AddDiagnoser(MemoryDiagnoser.Default); | ||
//AddExporter(CsvMeasurementsExporter.Default); | ||
//AddExporter(HtmlExporter.Default); | ||
AddExporter(MarkdownExporter.GitHub); | ||
AddLogger(ConsoleLogger.Default); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
benchmarks/D2SLib_Local.Benchmark/D2SLib_Local.Benchmark.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFrameworks>net6.0;netcoreapp3.1</TargetFrameworks> | ||
<LangVersion>10</LangVersion> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<RootNamespace>D2SLib_Benchmark</RootNamespace> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<None Include="..\..\test\Resources\**\*"> | ||
<Link>Resources\%(RecursiveDir)\%(FileName)%(Extension)</Link> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="BenchmarkDotNet" Version="0.13.1" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\src\D2SLib.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using BenchmarkDotNet.Attributes; | ||
using D2SLib; | ||
|
||
namespace D2SLib_Benchmark; | ||
|
||
[Config(typeof(BenchmarkConfig))] | ||
public class LoadGame | ||
{ | ||
private byte[] _saveData = Array.Empty<byte>(); | ||
|
||
[Benchmark] | ||
public void LoadComplexSave() | ||
{ | ||
_ = Core.ReadD2S(_saveData); | ||
} | ||
|
||
[GlobalSetup] | ||
public void GlobalSetup() | ||
{ | ||
_saveData = File.ReadAllBytes(@"Resources\D2S\1.15\DannyIsGreat.d2s"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
using BenchmarkDotNet.Running; | ||
|
||
BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args); |
29 changes: 29 additions & 0 deletions
29
benchmarks/D2SLib_Nuget.Benchmark/D2SLib_Nuget.Benchmark.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFrameworks>net6.0;netcoreapp3.1</TargetFrameworks> | ||
<LangVersion>10</LangVersion> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<RootNamespace>D2SLib_Benchmark</RootNamespace> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<None Include="..\..\test\Resources\**\*"> | ||
<Link>Resources\%(RecursiveDir)\%(FileName)%(Extension)</Link> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Compile Include="..\D2SLib_Local.Benchmark\BenchmarkConfig.cs" Link="BenchmarkConfig.cs" /> | ||
<Compile Include="..\D2SLib_Local.Benchmark\LoadGame.cs" Link="LoadGame.cs" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="BenchmarkDotNet" Version="0.13.1" /> | ||
<PackageReference Include="D2SLib" Version="1.0.2" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
using BenchmarkDotNet.Running; | ||
|
||
BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
Original, load complex save: | ||
|
||
| Method | Job | Runtime | Mean | Error | StdDev | Allocated | | ||
|---------------- |----------- |-------------- |---------:|--------:|--------:|----------:| | ||
| LoadComplexSave | Job-SSHODX | .NET 6.0 | 171.1 ms | 3.40 ms | 7.67 ms | 1 MB | | ||
| LoadComplexSave | Job-AEQOGU | .NET Core 3.1 | 170.7 ms | 3.39 ms | 7.51 ms | 1 MB | | ||
|
||
Revised, load same save: | ||
|
||
| Method | Job | Runtime | Mean | Error | StdDev | Gen 0 | Gen 1 | Allocated | | ||
|---------------- |----------- |-------------- |---------:|----------:|----------:|--------:|-------:|----------:| | ||
| LoadComplexSave | Job-KBRNVU | .NET 6.0 | 1.359 ms | 0.0175 ms | 0.0163 ms | 23.4375 | 3.9063 | 115 KB | | ||
| LoadComplexSave | Job-ALJOBF | .NET Core 3.1 | 2.148 ms | 0.0180 ms | 0.0168 ms | 23.4375 | 3.9063 | 115 KB | | ||
|