Add benchmarks

This commit is contained in:
Frederik Carlier
2018-06-19 11:16:14 +02:00
parent d72c599c5d
commit c8f762da73
8 changed files with 95 additions and 5 deletions

View File

@@ -0,0 +1,26 @@
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Attributes.Jobs;
using System.IO;
namespace Claunia.PropertyList.Benchmark
{
[CoreJob]
[MemoryDiagnoser]
public class BinaryPropertyListParserBenchmarks
{
private byte[] data = null;
[GlobalSetup]
public void Setup()
{
data = File.ReadAllBytes("plist.bin");
}
[Benchmark]
public NSObject ReadLargePropertylistTest()
{
var nsObject = PropertyListParser.Parse(this.data);
return nsObject;
}
}
}

View File

@@ -0,0 +1,13 @@
using BenchmarkDotNet.Running;
using System;
namespace Claunia.PropertyList.Benchmark
{
class Program
{
static void Main(string[] args)
{
var summary = BenchmarkRunner.Run<BinaryPropertyListParserBenchmarks>();
}
}
}

View File

@@ -0,0 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
<RootNamespace>Claunia.PropertyList.Benchmark</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.10.14" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\plist-cil\plist-cil.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="plist.bin">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

Binary file not shown.