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

4
.gitignore vendored
View File

@@ -9,6 +9,10 @@
*.user
*.sln.docstates
# BenchmarkDotNet artifacts
BenchmarkDotNet.Artifacts
*.etl
# Build results
[Dd]ebug/
[Dd]ebugPublic/

View File

@@ -2,8 +2,9 @@ language: csharp
solution: plist-cil.sln
mono:
- none
dotnet: 2.1.200
dotnet: 2.1.300
dist: trusty
script:
- dotnet build -c Release
- dotnet test plist-cil.test/plist-cil.test.csproj
- dotnet test plist-cil.test/plist-cil.test.csproj
- dotnet run --project plist-cil.benchmark/plist-cil.benchmark.csproj -c Release

View File

@@ -1,9 +1,11 @@
build_script:
- cmd: dotnet build -c Release --version-suffix r%APPVEYOR_BUILD_NUMBER%
- cmd: dotnet test plist-cil.test\plist-cil.test.csproj
- cmd: dotnet run --project plist-cil.benchmark/plist-cil.benchmark.csproj -c Release
on_success:
- cmd: dotnet pack plist-cil\plist-cil.csproj -c Release --version-suffix r%APPVEYOR_BUILD_NUMBER%
artifacts:
- path: "plist-cil\\bin\\Release\\plist-cil.*.nupkg"
- path: "plist-cil\\bin\\Release\\plist-cil.*.nupkg"
- path: "plist-cil.benchmark\\BenchmarkDotNet.Artifacts\\results\\*.*"

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.

View File

@@ -5,9 +5,11 @@ VisualStudioVersion = 15.0.26430.6
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{25B9F55C-9830-4526-9539-949838B09EAC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "plist-cil", "plist-cil\plist-cil.csproj", "{2A906AEB-BDE0-4356-8114-064F80596C7D}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "plist-cil", "plist-cil\plist-cil.csproj", "{2A906AEB-BDE0-4356-8114-064F80596C7D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "plist-cil.test", "plist-cil.test\plist-cil.test.csproj", "{17124CCE-32F1-4FD6-8703-32235BDEEEDC}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "plist-cil.test", "plist-cil.test\plist-cil.test.csproj", "{17124CCE-32F1-4FD6-8703-32235BDEEEDC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "plist-cil.benchmark", "plist-cil.benchmark\plist-cil.benchmark.csproj", "{2AE44841-2E54-4310-843C-8DEE786E5052}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -53,10 +55,29 @@ Global
{17124CCE-32F1-4FD6-8703-32235BDEEEDC}.Release|x64.Build.0 = Release|Any CPU
{17124CCE-32F1-4FD6-8703-32235BDEEEDC}.Release|x86.ActiveCfg = Release|Any CPU
{17124CCE-32F1-4FD6-8703-32235BDEEEDC}.Release|x86.Build.0 = Release|Any CPU
{2AE44841-2E54-4310-843C-8DEE786E5052}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2AE44841-2E54-4310-843C-8DEE786E5052}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2AE44841-2E54-4310-843C-8DEE786E5052}.Debug|ARM.ActiveCfg = Debug|Any CPU
{2AE44841-2E54-4310-843C-8DEE786E5052}.Debug|ARM.Build.0 = Debug|Any CPU
{2AE44841-2E54-4310-843C-8DEE786E5052}.Debug|x64.ActiveCfg = Debug|Any CPU
{2AE44841-2E54-4310-843C-8DEE786E5052}.Debug|x64.Build.0 = Debug|Any CPU
{2AE44841-2E54-4310-843C-8DEE786E5052}.Debug|x86.ActiveCfg = Debug|Any CPU
{2AE44841-2E54-4310-843C-8DEE786E5052}.Debug|x86.Build.0 = Debug|Any CPU
{2AE44841-2E54-4310-843C-8DEE786E5052}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2AE44841-2E54-4310-843C-8DEE786E5052}.Release|Any CPU.Build.0 = Release|Any CPU
{2AE44841-2E54-4310-843C-8DEE786E5052}.Release|ARM.ActiveCfg = Release|Any CPU
{2AE44841-2E54-4310-843C-8DEE786E5052}.Release|ARM.Build.0 = Release|Any CPU
{2AE44841-2E54-4310-843C-8DEE786E5052}.Release|x64.ActiveCfg = Release|Any CPU
{2AE44841-2E54-4310-843C-8DEE786E5052}.Release|x64.Build.0 = Release|Any CPU
{2AE44841-2E54-4310-843C-8DEE786E5052}.Release|x86.ActiveCfg = Release|Any CPU
{2AE44841-2E54-4310-843C-8DEE786E5052}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {2F7CD736-97E1-4DD8-B88D-FE77EDDA178E}
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
Policies = $0
$0.DotNetNamingPolicy = $1