mirror of
https://github.com/claunia/plist-cil.git
synced 2025-12-16 11:04:26 +00:00
Add benchmarks
This commit is contained in:
26
plist-cil.benchmark/BinaryPropertyListParserBenchmarks.cs
Normal file
26
plist-cil.benchmark/BinaryPropertyListParserBenchmarks.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
13
plist-cil.benchmark/Program.cs
Normal file
13
plist-cil.benchmark/Program.cs
Normal 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>();
|
||||
}
|
||||
}
|
||||
}
|
||||
23
plist-cil.benchmark/plist-cil.benchmark.csproj
Normal file
23
plist-cil.benchmark/plist-cil.benchmark.csproj
Normal 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>
|
||||
BIN
plist-cil.benchmark/plist.bin
Normal file
BIN
plist-cil.benchmark/plist.bin
Normal file
Binary file not shown.
Reference in New Issue
Block a user