diff --git a/.gitignore b/.gitignore index 9813e28..028e7e5 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,10 @@ *.user *.sln.docstates +# BenchmarkDotNet artifacts +BenchmarkDotNet.Artifacts +*.etl + # Build results [Dd]ebug/ [Dd]ebugPublic/ diff --git a/.travis.yml b/.travis.yml index 137f12f..bd40cc3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 \ No newline at end of file + - dotnet test plist-cil.test/plist-cil.test.csproj + - dotnet run --project plist-cil.benchmark/plist-cil.benchmark.csproj -c Release diff --git a/appveyor.yml b/appveyor.yml index 1e49dcc..f802d52 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -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" \ No newline at end of file + - path: "plist-cil\\bin\\Release\\plist-cil.*.nupkg" + - path: "plist-cil.benchmark\\BenchmarkDotNet.Artifacts\\results\\*.*" \ No newline at end of file diff --git a/plist-cil.benchmark/BinaryPropertyListParserBenchmarks.cs b/plist-cil.benchmark/BinaryPropertyListParserBenchmarks.cs new file mode 100644 index 0000000..2db8fc2 --- /dev/null +++ b/plist-cil.benchmark/BinaryPropertyListParserBenchmarks.cs @@ -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; + } + } +} diff --git a/plist-cil.benchmark/Program.cs b/plist-cil.benchmark/Program.cs new file mode 100644 index 0000000..77e5397 --- /dev/null +++ b/plist-cil.benchmark/Program.cs @@ -0,0 +1,13 @@ +using BenchmarkDotNet.Running; +using System; + +namespace Claunia.PropertyList.Benchmark +{ + class Program + { + static void Main(string[] args) + { + var summary = BenchmarkRunner.Run(); + } + } +} diff --git a/plist-cil.benchmark/plist-cil.benchmark.csproj b/plist-cil.benchmark/plist-cil.benchmark.csproj new file mode 100644 index 0000000..1ce0f46 --- /dev/null +++ b/plist-cil.benchmark/plist-cil.benchmark.csproj @@ -0,0 +1,23 @@ + + + + Exe + netcoreapp2.1 + Claunia.PropertyList.Benchmark + + + + + + + + + + + + + PreserveNewest + + + + diff --git a/plist-cil.benchmark/plist.bin b/plist-cil.benchmark/plist.bin new file mode 100644 index 0000000..a89955d Binary files /dev/null and b/plist-cil.benchmark/plist.bin differ diff --git a/plist-cil.sln b/plist-cil.sln index e9e21a2..cef2d08 100644 --- a/plist-cil.sln +++ b/plist-cil.sln @@ -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