Code refactor and clean-up to follow new C# 9 conventions and features where applicable.

This commit is contained in:
2021-04-30 13:06:04 +01:00
parent a72e7ad0e4
commit 19756723a3
34 changed files with 2467 additions and 2691 deletions

View File

@@ -1,25 +1,22 @@
using BenchmarkDotNet.Attributes;
using System.IO;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Jobs;
using System.IO;
namespace Claunia.PropertyList.Benchmark
{
[SimpleJob(RuntimeMoniker.NetCoreApp50)]
[MemoryDiagnoser]
[SimpleJob(RuntimeMoniker.NetCoreApp50), MemoryDiagnoser]
public class BinaryPropertyListParserBenchmarks
{
byte[] data;
[GlobalSetup]
public void Setup()
{
data = File.ReadAllBytes("plist.bin");
}
public void Setup() => data = File.ReadAllBytes("plist.bin");
[Benchmark]
public NSObject ReadLargePropertylistTest()
{
NSObject nsObject = PropertyListParser.Parse(data);
return nsObject;
}
}

View File

@@ -3,22 +3,15 @@ using BenchmarkDotNet.Jobs;
namespace Claunia.PropertyList.Benchmark
{
[SimpleJob(RuntimeMoniker.NetCoreApp50)]
[MemoryDiagnoser]
[SimpleJob(RuntimeMoniker.NetCoreApp50), MemoryDiagnoser]
public class BinaryPropertyListWriterBenchmarks
{
NSObject data;
[GlobalSetup]
public void Setup()
{
data = PropertyListParser.Parse("plist.bin");
}
public void Setup() => data = PropertyListParser.Parse("plist.bin");
[Benchmark]
public byte[] WriteLargePropertylistTest()
{
return BinaryPropertyListWriter.WriteToArray(data);
}
public byte[] WriteLargePropertylistTest() => BinaryPropertyListWriter.WriteToArray(data);
}
}

View File

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