mirror of
https://github.com/claunia/plist-cil.git
synced 2025-12-16 11:04:26 +00:00
Code refactor and clean-up to follow new C# 9 conventions and features where applicable.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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>();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user