Move to block based namespaces so it can compile with .NET Core 3.1.

This commit is contained in:
2023-09-21 14:03:21 +01:00
parent 2bd046ef06
commit 362aea152c
9 changed files with 1840 additions and 1813 deletions

View File

@@ -8,13 +8,15 @@ using BenchmarkDotNet.Toolchains.CsProj;
using BenchmarkDotNet.Toolchains.DotNetCli; using BenchmarkDotNet.Toolchains.DotNetCli;
#if NET8_0_OR_GREATER #if NET8_0_OR_GREATER
using AaruBenchmark.Compression; using AaruBenchmark.Compression;
// ReSharper disable ArrangeNamespaceBody
#endif #endif
namespace AaruBenchmark; namespace AaruBenchmark
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Assembly)]
public class Core31RosettaJobAttribute : Attribute, IConfigSource
{ {
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Assembly)]
public class Core31RosettaJobAttribute : Attribute, IConfigSource
{
public Core31RosettaJobAttribute() public Core31RosettaJobAttribute()
{ {
Job job = new Job(".NET Core 3.1 (x64)", RunMode.Default).WithRuntime(CoreRuntime.Core31); Job job = new Job(".NET Core 3.1 (x64)", RunMode.Default).WithRuntime(CoreRuntime.Core31);
@@ -26,13 +28,13 @@ public class Core31RosettaJobAttribute : Attribute, IConfigSource
} }
public IConfig Config { get; } public IConfig Config { get; }
} }
[SimpleJob(RuntimeMoniker.NetCoreApp31), Core31RosettaJob, SimpleJob(RuntimeMoniker.Net80), [SimpleJob(RuntimeMoniker.NetCoreApp31), Core31RosettaJob, SimpleJob(RuntimeMoniker.Net80),
SimpleJob(RuntimeMoniker.NativeAot80)] SimpleJob(RuntimeMoniker.NativeAot80)]
public class ADCBenchs public class ADCBenchs
{ {
#if NET8_0_OR_GREATER #if NET8_0_OR_GREATER
[Benchmark] [Benchmark]
public void Aaru() => throw new NotImplementedException(); public void Aaru() => throw new NotImplementedException();
@@ -41,7 +43,7 @@ public class ADCBenchs
[Benchmark] [Benchmark]
public void AaruNative() => Compression.AaruNative.ADC(); public void AaruNative() => Compression.AaruNative.ADC();
#else #else
[Benchmark(Baseline = true)] [Benchmark(Baseline = true)]
public void Aaru() => Compression.SharpCompress.ADC(); public void Aaru() => Compression.SharpCompress.ADC();
@@ -50,14 +52,14 @@ public class ADCBenchs
[Benchmark] [Benchmark]
public void AaruNative() => throw new NotImplementedException(); public void AaruNative() => throw new NotImplementedException();
#endif #endif
} }
[SimpleJob(RuntimeMoniker.NetCoreApp31), Core31RosettaJob, SimpleJob(RuntimeMoniker.Net80), [SimpleJob(RuntimeMoniker.NetCoreApp31), Core31RosettaJob, SimpleJob(RuntimeMoniker.Net80),
SimpleJob(RuntimeMoniker.NativeAot80)] SimpleJob(RuntimeMoniker.NativeAot80)]
public class AppleRleBenchs public class AppleRleBenchs
{ {
#if NET8_0_OR_GREATER #if NET8_0_OR_GREATER
[Benchmark] [Benchmark]
public void Aaru() => throw new NotImplementedException(); public void Aaru() => throw new NotImplementedException();
@@ -66,7 +68,7 @@ public class AppleRleBenchs
[Benchmark] [Benchmark]
public void AaruNative() => Compression.AaruNative.AppleRle(); public void AaruNative() => Compression.AaruNative.AppleRle();
#else #else
[Benchmark(Baseline = true)] [Benchmark(Baseline = true)]
public void Aaru() => Compression.Aaru.AppleRle(); public void Aaru() => Compression.Aaru.AppleRle();
@@ -75,77 +77,77 @@ public class AppleRleBenchs
[Benchmark] [Benchmark]
public void AaruNative() => throw new NotImplementedException(); public void AaruNative() => throw new NotImplementedException();
#endif #endif
} }
[SimpleJob(RuntimeMoniker.NetCoreApp31), Core31RosettaJob, SimpleJob(RuntimeMoniker.Net80), [SimpleJob(RuntimeMoniker.NetCoreApp31), Core31RosettaJob, SimpleJob(RuntimeMoniker.Net80),
SimpleJob(RuntimeMoniker.NativeAot80)] SimpleJob(RuntimeMoniker.NativeAot80)]
public class TeleDiskLzhBenchs public class TeleDiskLzhBenchs
{ {
#if NET8_0_OR_GREATER #if NET8_0_OR_GREATER
[Benchmark] [Benchmark]
public void Aaru() => throw new NotImplementedException(); public void Aaru() => throw new NotImplementedException();
[Benchmark(Baseline = true)] [Benchmark(Baseline = true)]
public void Aaru6() => Aaru6Compressions.TeleDiskLzh(); public void Aaru6() => Aaru6Compressions.TeleDiskLzh();
#else #else
[Benchmark(Baseline = true)] [Benchmark(Baseline = true)]
public void Aaru() => Compression.Aaru.TeleDiskLzh(); public void Aaru() => Compression.Aaru.TeleDiskLzh();
[Benchmark] [Benchmark]
public void Aaru6() => throw new NotImplementedException(); public void Aaru6() => throw new NotImplementedException();
#endif #endif
} }
[SimpleJob(RuntimeMoniker.NetCoreApp31), Core31RosettaJob, SimpleJob(RuntimeMoniker.Net80), [SimpleJob(RuntimeMoniker.NetCoreApp31), Core31RosettaJob, SimpleJob(RuntimeMoniker.Net80),
SimpleJob(RuntimeMoniker.NativeAot80)] SimpleJob(RuntimeMoniker.NativeAot80)]
public class GzipBenchs public class GzipBenchs
{ {
#if NET8_0_OR_GREATER #if NET8_0_OR_GREATER
[Benchmark] [Benchmark]
public void Aaru() => throw new NotImplementedException(); public void Aaru() => throw new NotImplementedException();
[Benchmark(Baseline = true)] [Benchmark(Baseline = true)]
public void Aaru6() => NetRuntime.Gzip(); public void Aaru6() => NetRuntime.Gzip();
#else #else
[Benchmark(Baseline = true)] [Benchmark(Baseline = true)]
public void Aaru() => Compression.SharpCompress.Gzip(); public void Aaru() => Compression.SharpCompress.Gzip();
[Benchmark] [Benchmark]
public void Aaru6() => throw new NotImplementedException(); public void Aaru6() => throw new NotImplementedException();
#endif #endif
[Benchmark] [Benchmark]
public void DotNetZip() => Compression.DotNetZip.Gzip(); public void DotNetZip() => Compression.DotNetZip.Gzip();
} }
[SimpleJob(RuntimeMoniker.NetCoreApp31), Core31RosettaJob, SimpleJob(RuntimeMoniker.Net80), [SimpleJob(RuntimeMoniker.NetCoreApp31), Core31RosettaJob, SimpleJob(RuntimeMoniker.Net80),
SimpleJob(RuntimeMoniker.NativeAot80)] SimpleJob(RuntimeMoniker.NativeAot80)]
public class CompressGzipBenchs public class CompressGzipBenchs
{ {
#if NET8_0_OR_GREATER #if NET8_0_OR_GREATER
[Benchmark] [Benchmark]
public void Aaru() => throw new NotImplementedException(); public void Aaru() => throw new NotImplementedException();
[Benchmark(Baseline = true)] [Benchmark(Baseline = true)]
public void Aaru6() => NetRuntime.CompressGzip(); public void Aaru6() => NetRuntime.CompressGzip();
#else #else
[Benchmark(Baseline = true)] [Benchmark(Baseline = true)]
public void Aaru() => Compression.SharpCompress.CompressGzip(); public void Aaru() => Compression.SharpCompress.CompressGzip();
[Benchmark] [Benchmark]
public void Aaru6() => throw new NotImplementedException(); public void Aaru6() => throw new NotImplementedException();
#endif #endif
[Benchmark] [Benchmark]
public void DotNetZip() => Compression.DotNetZip.CompressGzip(); public void DotNetZip() => Compression.DotNetZip.CompressGzip();
} }
[SimpleJob(RuntimeMoniker.NetCoreApp31), Core31RosettaJob, SimpleJob(RuntimeMoniker.Net80), [SimpleJob(RuntimeMoniker.NetCoreApp31), Core31RosettaJob, SimpleJob(RuntimeMoniker.Net80),
SimpleJob(RuntimeMoniker.NativeAot80)] SimpleJob(RuntimeMoniker.NativeAot80)]
public class Bzip2Benchs public class Bzip2Benchs
{ {
#if NET8_0_OR_GREATER #if NET8_0_OR_GREATER
[Benchmark] [Benchmark]
public void Aaru() => throw new NotImplementedException(); public void Aaru() => throw new NotImplementedException();
@@ -154,7 +156,7 @@ public class Bzip2Benchs
[Benchmark] [Benchmark]
public void AaruNative() => Compression.AaruNative.Bzip2(); public void AaruNative() => Compression.AaruNative.Bzip2();
#else #else
[Benchmark(Baseline = true)] [Benchmark(Baseline = true)]
public void Aaru() => Compression.SharpCompress.Bzip2(); public void Aaru() => Compression.SharpCompress.Bzip2();
@@ -163,14 +165,14 @@ public class Bzip2Benchs
[Benchmark] [Benchmark]
public void AaruNative() => throw new NotImplementedException(); public void AaruNative() => throw new NotImplementedException();
#endif #endif
} }
[SimpleJob(RuntimeMoniker.NetCoreApp31), Core31RosettaJob, SimpleJob(RuntimeMoniker.Net80), [SimpleJob(RuntimeMoniker.NetCoreApp31), Core31RosettaJob, SimpleJob(RuntimeMoniker.Net80),
SimpleJob(RuntimeMoniker.NativeAot80)] SimpleJob(RuntimeMoniker.NativeAot80)]
public class CompressBzip2Benchs public class CompressBzip2Benchs
{ {
#if NET8_0_OR_GREATER #if NET8_0_OR_GREATER
[Benchmark] [Benchmark]
public void Aaru() => throw new NotImplementedException(); public void Aaru() => throw new NotImplementedException();
@@ -179,7 +181,7 @@ public class CompressBzip2Benchs
[Benchmark] [Benchmark]
public void AaruNative() => Compression.AaruNative.CompressBzip2(); public void AaruNative() => Compression.AaruNative.CompressBzip2();
#else #else
[Benchmark(Baseline = true)] [Benchmark(Baseline = true)]
public void Aaru() => Compression.SharpCompress.CompressBzip2(); public void Aaru() => Compression.SharpCompress.CompressBzip2();
@@ -188,109 +190,109 @@ public class CompressBzip2Benchs
[Benchmark] [Benchmark]
public void AaruNative() => throw new NotImplementedException(); public void AaruNative() => throw new NotImplementedException();
#endif #endif
} }
[SimpleJob(RuntimeMoniker.NetCoreApp31), Core31RosettaJob, SimpleJob(RuntimeMoniker.Net80), [SimpleJob(RuntimeMoniker.NetCoreApp31), Core31RosettaJob, SimpleJob(RuntimeMoniker.Net80),
SimpleJob(RuntimeMoniker.NativeAot80)] SimpleJob(RuntimeMoniker.NativeAot80)]
public class LzipBenchs public class LzipBenchs
{ {
[Benchmark(Baseline = true)] [Benchmark(Baseline = true)]
public void Aaru() => Compression.SharpCompress.Lzip(); public void Aaru() => Compression.SharpCompress.Lzip();
#if NET8_0_OR_GREATER #if NET8_0_OR_GREATER
[Benchmark] [Benchmark]
public void AaruNative() => Compression.AaruNative.Lzip(); public void AaruNative() => Compression.AaruNative.Lzip();
#else #else
[Benchmark] [Benchmark]
public void AaruNative() => throw new NotImplementedException(); public void AaruNative() => throw new NotImplementedException();
#endif #endif
} }
[SimpleJob(RuntimeMoniker.NetCoreApp31), Core31RosettaJob, SimpleJob(RuntimeMoniker.Net80), [SimpleJob(RuntimeMoniker.NetCoreApp31), Core31RosettaJob, SimpleJob(RuntimeMoniker.Net80),
SimpleJob(RuntimeMoniker.NativeAot80)] SimpleJob(RuntimeMoniker.NativeAot80)]
public class CompressLzipBenchs public class CompressLzipBenchs
{ {
[Benchmark(Baseline = true)] [Benchmark(Baseline = true)]
public void Aaru() => Compression.SharpCompress.CompressLzip(); public void Aaru() => Compression.SharpCompress.CompressLzip();
#if NET8_0_OR_GREATER #if NET8_0_OR_GREATER
[Benchmark] [Benchmark]
public void AaruNative() => Compression.AaruNative.CompressLzip(); public void AaruNative() => Compression.AaruNative.CompressLzip();
#else #else
[Benchmark] [Benchmark]
public void AaruNative() => throw new NotImplementedException(); public void AaruNative() => throw new NotImplementedException();
#endif #endif
} }
[SimpleJob(RuntimeMoniker.NetCoreApp31), Core31RosettaJob, SimpleJob(RuntimeMoniker.Net80), [SimpleJob(RuntimeMoniker.NetCoreApp31), Core31RosettaJob, SimpleJob(RuntimeMoniker.Net80),
SimpleJob(RuntimeMoniker.NativeAot80)] SimpleJob(RuntimeMoniker.NativeAot80)]
public class LzmaBenchs public class LzmaBenchs
{ {
[Benchmark(Baseline = true)] [Benchmark(Baseline = true)]
public void Aaru() => Compression.SharpCompress.Lzma(); public void Aaru() => Compression.SharpCompress.Lzma();
#if NET8_0_OR_GREATER #if NET8_0_OR_GREATER
[Benchmark] [Benchmark]
public void AaruNative() => Compression.AaruNative.Lzma(); public void AaruNative() => Compression.AaruNative.Lzma();
#else #else
[Benchmark] [Benchmark]
public void AaruNative() => throw new NotImplementedException(); public void AaruNative() => throw new NotImplementedException();
#endif #endif
} }
[SimpleJob(RuntimeMoniker.NetCoreApp31), Core31RosettaJob, SimpleJob(RuntimeMoniker.Net80), [SimpleJob(RuntimeMoniker.NetCoreApp31), Core31RosettaJob, SimpleJob(RuntimeMoniker.Net80),
SimpleJob(RuntimeMoniker.NativeAot80)] SimpleJob(RuntimeMoniker.NativeAot80)]
public class CompressLzmaBenchs public class CompressLzmaBenchs
{ {
[Benchmark(Baseline = true)] [Benchmark(Baseline = true)]
public void Aaru() => Compression.SharpCompress.CompressLzma(); public void Aaru() => Compression.SharpCompress.CompressLzma();
#if NET8_0_OR_GREATER #if NET8_0_OR_GREATER
[Benchmark] [Benchmark]
public void AaruNative() => Compression.AaruNative.CompressLzma(); public void AaruNative() => Compression.AaruNative.CompressLzma();
#else #else
[Benchmark] [Benchmark]
public void AaruNative() => throw new NotImplementedException(); public void AaruNative() => throw new NotImplementedException();
#endif #endif
} }
[SimpleJob(RuntimeMoniker.NetCoreApp31), Core31RosettaJob, SimpleJob(RuntimeMoniker.Net80), [SimpleJob(RuntimeMoniker.NetCoreApp31), Core31RosettaJob, SimpleJob(RuntimeMoniker.Net80),
SimpleJob(RuntimeMoniker.NativeAot80)] SimpleJob(RuntimeMoniker.NativeAot80)]
public class FlacBenchs public class FlacBenchs
{ {
[Benchmark(Baseline = true)] [Benchmark(Baseline = true)]
public void Aaru() => Compression.Aaru.Flac(); public void Aaru() => Compression.Aaru.Flac();
#if NET8_0_OR_GREATER #if NET8_0_OR_GREATER
[Benchmark] [Benchmark]
public void AaruNative() => Compression.AaruNative.Flac(); public void AaruNative() => Compression.AaruNative.Flac();
#else #else
[Benchmark] [Benchmark]
public void AaruNative() => throw new NotImplementedException(); public void AaruNative() => throw new NotImplementedException();
#endif #endif
} }
[SimpleJob(RuntimeMoniker.NetCoreApp31), Core31RosettaJob, SimpleJob(RuntimeMoniker.Net80), [SimpleJob(RuntimeMoniker.NetCoreApp31), Core31RosettaJob, SimpleJob(RuntimeMoniker.Net80),
SimpleJob(RuntimeMoniker.NativeAot80)] SimpleJob(RuntimeMoniker.NativeAot80)]
public class CompressFlacBenchs public class CompressFlacBenchs
{ {
[Benchmark(Baseline = true)] [Benchmark(Baseline = true)]
public void Aaru() => Compression.Aaru.CompressFlac(); public void Aaru() => Compression.Aaru.CompressFlac();
#if NET8_0_OR_GREATER #if NET8_0_OR_GREATER
[Benchmark] [Benchmark]
public void AaruNative() => Compression.AaruNative.CompressFlac(); public void AaruNative() => Compression.AaruNative.CompressFlac();
#else #else
[Benchmark] [Benchmark]
public void AaruNative() => throw new NotImplementedException(); public void AaruNative() => throw new NotImplementedException();
#endif #endif
} }
[SimpleJob(RuntimeMoniker.NetCoreApp31), Core31RosettaJob, SimpleJob(RuntimeMoniker.Net80), [SimpleJob(RuntimeMoniker.NetCoreApp31), Core31RosettaJob, SimpleJob(RuntimeMoniker.Net80),
SimpleJob(RuntimeMoniker.NativeAot80)] SimpleJob(RuntimeMoniker.NativeAot80)]
public class Adler32Benchs public class Adler32Benchs
{ {
#if NET8_0_OR_GREATER #if NET8_0_OR_GREATER
[Benchmark] [Benchmark]
public void Aaru() => throw new NotImplementedException(); public void Aaru() => throw new NotImplementedException();
@@ -299,7 +301,7 @@ public class Adler32Benchs
[Benchmark] [Benchmark]
public void AaruNative() => Checksums.AaruNative.Adler32(); public void AaruNative() => Checksums.AaruNative.Adler32();
#else #else
[Benchmark(Baseline = true)] [Benchmark(Baseline = true)]
public void Aaru() => Checksums.Aaru.Adler32(); public void Aaru() => Checksums.Aaru.Adler32();
@@ -308,14 +310,14 @@ public class Adler32Benchs
[Benchmark] [Benchmark]
public void AaruNative() => throw new NotImplementedException(); public void AaruNative() => throw new NotImplementedException();
#endif #endif
} }
[SimpleJob(RuntimeMoniker.NetCoreApp31), Core31RosettaJob, SimpleJob(RuntimeMoniker.Net80), [SimpleJob(RuntimeMoniker.NetCoreApp31), Core31RosettaJob, SimpleJob(RuntimeMoniker.Net80),
SimpleJob(RuntimeMoniker.NativeAot80)] SimpleJob(RuntimeMoniker.NativeAot80)]
public class Fletcher16Benchs public class Fletcher16Benchs
{ {
#if NET8_0_OR_GREATER #if NET8_0_OR_GREATER
[Benchmark] [Benchmark]
public void Aaru() => throw new NotImplementedException(); public void Aaru() => throw new NotImplementedException();
@@ -324,7 +326,7 @@ public class Fletcher16Benchs
[Benchmark] [Benchmark]
public void AaruNative() => Checksums.AaruNative.Fletcher16(); public void AaruNative() => Checksums.AaruNative.Fletcher16();
#else #else
[Benchmark(Baseline = true)] [Benchmark(Baseline = true)]
public void Aaru() => Checksums.Aaru.Fletcher16(); public void Aaru() => Checksums.Aaru.Fletcher16();
@@ -333,14 +335,14 @@ public class Fletcher16Benchs
[Benchmark] [Benchmark]
public void AaruNative() => throw new NotImplementedException(); public void AaruNative() => throw new NotImplementedException();
#endif #endif
} }
[SimpleJob(RuntimeMoniker.NetCoreApp31), Core31RosettaJob, SimpleJob(RuntimeMoniker.Net80), [SimpleJob(RuntimeMoniker.NetCoreApp31), Core31RosettaJob, SimpleJob(RuntimeMoniker.Net80),
SimpleJob(RuntimeMoniker.NativeAot80)] SimpleJob(RuntimeMoniker.NativeAot80)]
public class Fletcher32Benchs public class Fletcher32Benchs
{ {
#if NET8_0_OR_GREATER #if NET8_0_OR_GREATER
[Benchmark] [Benchmark]
public void Aaru() => throw new NotImplementedException(); public void Aaru() => throw new NotImplementedException();
@@ -349,7 +351,7 @@ public class Fletcher32Benchs
[Benchmark] [Benchmark]
public void AaruNative() => Checksums.AaruNative.Fletcher32(); public void AaruNative() => Checksums.AaruNative.Fletcher32();
#else #else
[Benchmark(Baseline = true)] [Benchmark(Baseline = true)]
public void Aaru() => Checksums.Aaru.Fletcher32(); public void Aaru() => Checksums.Aaru.Fletcher32();
@@ -358,14 +360,14 @@ public class Fletcher32Benchs
[Benchmark] [Benchmark]
public void AaruNative() => throw new NotImplementedException(); public void AaruNative() => throw new NotImplementedException();
#endif #endif
} }
[SimpleJob(RuntimeMoniker.NetCoreApp31), Core31RosettaJob, SimpleJob(RuntimeMoniker.Net80), [SimpleJob(RuntimeMoniker.NetCoreApp31), Core31RosettaJob, SimpleJob(RuntimeMoniker.Net80),
SimpleJob(RuntimeMoniker.NativeAot80)] SimpleJob(RuntimeMoniker.NativeAot80)]
public class Crc16CcittBenchs public class Crc16CcittBenchs
{ {
#if NET8_0_OR_GREATER #if NET8_0_OR_GREATER
[Benchmark] [Benchmark]
public void Aaru() => throw new NotImplementedException(); public void Aaru() => throw new NotImplementedException();
@@ -374,7 +376,7 @@ public class Crc16CcittBenchs
[Benchmark] [Benchmark]
public void AaruNative() => Checksums.AaruNative.Crc16Ccitt(); public void AaruNative() => Checksums.AaruNative.Crc16Ccitt();
#else #else
[Benchmark(Baseline = true)] [Benchmark(Baseline = true)]
public void Aaru() => Checksums.Aaru.Crc16Ccitt(); public void Aaru() => Checksums.Aaru.Crc16Ccitt();
@@ -383,14 +385,14 @@ public class Crc16CcittBenchs
[Benchmark] [Benchmark]
public void AaruNative() => throw new NotImplementedException(); public void AaruNative() => throw new NotImplementedException();
#endif #endif
} }
[SimpleJob(RuntimeMoniker.NetCoreApp31), Core31RosettaJob, SimpleJob(RuntimeMoniker.Net80), [SimpleJob(RuntimeMoniker.NetCoreApp31), Core31RosettaJob, SimpleJob(RuntimeMoniker.Net80),
SimpleJob(RuntimeMoniker.NativeAot80)] SimpleJob(RuntimeMoniker.NativeAot80)]
public class Crc16Benchs public class Crc16Benchs
{ {
#if NET8_0_OR_GREATER #if NET8_0_OR_GREATER
[Benchmark] [Benchmark]
public void Aaru() => throw new NotImplementedException(); public void Aaru() => throw new NotImplementedException();
@@ -399,7 +401,7 @@ public class Crc16Benchs
[Benchmark] [Benchmark]
public void AaruNative() => Checksums.AaruNative.Crc16(); public void AaruNative() => Checksums.AaruNative.Crc16();
#else #else
[Benchmark(Baseline = true)] [Benchmark(Baseline = true)]
public void Aaru() => Checksums.Aaru.Crc16(); public void Aaru() => Checksums.Aaru.Crc16();
@@ -408,14 +410,14 @@ public class Crc16Benchs
[Benchmark] [Benchmark]
public void AaruNative() => throw new NotImplementedException(); public void AaruNative() => throw new NotImplementedException();
#endif #endif
} }
[SimpleJob(RuntimeMoniker.NetCoreApp31), Core31RosettaJob, SimpleJob(RuntimeMoniker.Net80), [SimpleJob(RuntimeMoniker.NetCoreApp31), Core31RosettaJob, SimpleJob(RuntimeMoniker.Net80),
SimpleJob(RuntimeMoniker.NativeAot80)] SimpleJob(RuntimeMoniker.NativeAot80)]
public class Crc32Benchs public class Crc32Benchs
{ {
#if NET8_0_OR_GREATER #if NET8_0_OR_GREATER
[Benchmark] [Benchmark]
public void Aaru() => throw new NotImplementedException(); public void Aaru() => throw new NotImplementedException();
@@ -424,7 +426,7 @@ public class Crc32Benchs
[Benchmark] [Benchmark]
public void AaruNative() => Checksums.AaruNative.Crc32(); public void AaruNative() => Checksums.AaruNative.Crc32();
#else #else
[Benchmark(Baseline = true)] [Benchmark(Baseline = true)]
public void Aaru() => Checksums.Aaru.Crc32(); public void Aaru() => Checksums.Aaru.Crc32();
@@ -433,17 +435,17 @@ public class Crc32Benchs
[Benchmark] [Benchmark]
public void AaruNative() => throw new NotImplementedException(); public void AaruNative() => throw new NotImplementedException();
#endif #endif
[Benchmark] [Benchmark]
public void rhash() => RHash.Crc32(); public void rhash() => RHash.Crc32();
} }
[SimpleJob(RuntimeMoniker.NetCoreApp31), Core31RosettaJob, SimpleJob(RuntimeMoniker.Net80), [SimpleJob(RuntimeMoniker.NetCoreApp31), Core31RosettaJob, SimpleJob(RuntimeMoniker.Net80),
SimpleJob(RuntimeMoniker.NativeAot80)] SimpleJob(RuntimeMoniker.NativeAot80)]
public class Crc64Benchs public class Crc64Benchs
{ {
#if NET8_0_OR_GREATER #if NET8_0_OR_GREATER
[Benchmark] [Benchmark]
public void Aaru() => throw new NotImplementedException(); public void Aaru() => throw new NotImplementedException();
@@ -452,7 +454,7 @@ public class Crc64Benchs
[Benchmark] [Benchmark]
public void AaruNative() => Checksums.AaruNative.Crc64(); public void AaruNative() => Checksums.AaruNative.Crc64();
#else #else
[Benchmark(Baseline = true)] [Benchmark(Baseline = true)]
public void Aaru() => Checksums.Aaru.Crc64(); public void Aaru() => Checksums.Aaru.Crc64();
@@ -461,13 +463,13 @@ public class Crc64Benchs
[Benchmark] [Benchmark]
public void AaruNative() => throw new NotImplementedException(); public void AaruNative() => throw new NotImplementedException();
#endif #endif
} }
[SimpleJob(RuntimeMoniker.NetCoreApp31), Core31RosettaJob, SimpleJob(RuntimeMoniker.Net80), [SimpleJob(RuntimeMoniker.NetCoreApp31), Core31RosettaJob, SimpleJob(RuntimeMoniker.Net80),
SimpleJob(RuntimeMoniker.NativeAot80)] SimpleJob(RuntimeMoniker.NativeAot80)]
public class Md5Benchs public class Md5Benchs
{ {
[Benchmark(Baseline = true)] [Benchmark(Baseline = true)]
public void Aaru() => Checksums.Aaru.Md5(); public void Aaru() => Checksums.Aaru.Md5();
@@ -476,12 +478,12 @@ public class Md5Benchs
[Benchmark] [Benchmark]
public void rhash() => RHash.Md5(); public void rhash() => RHash.Md5();
} }
[SimpleJob(RuntimeMoniker.NetCoreApp31), Core31RosettaJob, SimpleJob(RuntimeMoniker.Net80), [SimpleJob(RuntimeMoniker.NetCoreApp31), Core31RosettaJob, SimpleJob(RuntimeMoniker.Net80),
SimpleJob(RuntimeMoniker.NativeAot80)] SimpleJob(RuntimeMoniker.NativeAot80)]
public class Sha1Benchs public class Sha1Benchs
{ {
[Benchmark(Baseline = true)] [Benchmark(Baseline = true)]
public void Aaru() => Checksums.Aaru.Sha1(); public void Aaru() => Checksums.Aaru.Sha1();
@@ -490,12 +492,12 @@ public class Sha1Benchs
[Benchmark] [Benchmark]
public void rhash() => RHash.Sha1(); public void rhash() => RHash.Sha1();
} }
[SimpleJob(RuntimeMoniker.NetCoreApp31), Core31RosettaJob, SimpleJob(RuntimeMoniker.Net80), [SimpleJob(RuntimeMoniker.NetCoreApp31), Core31RosettaJob, SimpleJob(RuntimeMoniker.Net80),
SimpleJob(RuntimeMoniker.NativeAot80)] SimpleJob(RuntimeMoniker.NativeAot80)]
public class Sha256Benchs public class Sha256Benchs
{ {
[Benchmark(Baseline = true)] [Benchmark(Baseline = true)]
public void Aaru() => Checksums.Aaru.Sha256(); public void Aaru() => Checksums.Aaru.Sha256();
@@ -504,12 +506,12 @@ public class Sha256Benchs
[Benchmark] [Benchmark]
public void rhash() => RHash.Sha256(); public void rhash() => RHash.Sha256();
} }
[SimpleJob(RuntimeMoniker.NetCoreApp31), Core31RosettaJob, SimpleJob(RuntimeMoniker.Net80), [SimpleJob(RuntimeMoniker.NetCoreApp31), Core31RosettaJob, SimpleJob(RuntimeMoniker.Net80),
SimpleJob(RuntimeMoniker.NativeAot80)] SimpleJob(RuntimeMoniker.NativeAot80)]
public class Sha384Benchs public class Sha384Benchs
{ {
[Benchmark(Baseline = true)] [Benchmark(Baseline = true)]
public void Aaru() => Checksums.Aaru.Sha384(); public void Aaru() => Checksums.Aaru.Sha384();
@@ -518,12 +520,12 @@ public class Sha384Benchs
[Benchmark] [Benchmark]
public void rhash() => RHash.Sha384(); public void rhash() => RHash.Sha384();
} }
[SimpleJob(RuntimeMoniker.NetCoreApp31), Core31RosettaJob, SimpleJob(RuntimeMoniker.Net80), [SimpleJob(RuntimeMoniker.NetCoreApp31), Core31RosettaJob, SimpleJob(RuntimeMoniker.Net80),
SimpleJob(RuntimeMoniker.NativeAot80)] SimpleJob(RuntimeMoniker.NativeAot80)]
public class Sha512Benchs public class Sha512Benchs
{ {
[Benchmark(Baseline = true)] [Benchmark(Baseline = true)]
public void Aaru() => Checksums.Aaru.Sha512(); public void Aaru() => Checksums.Aaru.Sha512();
@@ -532,13 +534,13 @@ public class Sha512Benchs
[Benchmark] [Benchmark]
public void rhash() => RHash.Sha512(); public void rhash() => RHash.Sha512();
} }
[SimpleJob(RuntimeMoniker.NetCoreApp31), Core31RosettaJob, SimpleJob(RuntimeMoniker.Net80), [SimpleJob(RuntimeMoniker.NetCoreApp31), Core31RosettaJob, SimpleJob(RuntimeMoniker.Net80),
SimpleJob(RuntimeMoniker.NativeAot80)] SimpleJob(RuntimeMoniker.NativeAot80)]
public class SpamSumBenchs public class SpamSumBenchs
{ {
#if NET8_0_OR_GREATER #if NET8_0_OR_GREATER
[Benchmark] [Benchmark]
public void Aaru() => throw new NotImplementedException(); public void Aaru() => throw new NotImplementedException();
@@ -547,14 +549,15 @@ public class SpamSumBenchs
[Benchmark] [Benchmark]
public void AaruNative() => Checksums.AaruNative.SpamSum(); public void AaruNative() => Checksums.AaruNative.SpamSum();
#else #else
[Benchmark] [Benchmark]
public void Aaru6() => throw new NotImplementedException(); public void Aaru6() => throw new NotImplementedException();
[Benchmark] [Benchmark]
public void AaruNative() => throw new NotImplementedException(); public void AaruNative() => throw new NotImplementedException();
#endif #endif
[Benchmark] [Benchmark]
public void ssdeep() => Checksums.Aaru.CliSpamSum(); public void ssdeep() => Checksums.Aaru.CliSpamSum();
}
} }

View File

@@ -5,10 +5,12 @@ using System.Linq;
using Aaru.Checksums; using Aaru.Checksums;
using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Interfaces;
namespace AaruBenchmark.Checksums; // ReSharper disable ArrangeNamespaceBody
public class Aaru namespace AaruBenchmark.Checksums
{ {
public class Aaru
{
static readonly byte[] _expectedRandomAdler32 = static readonly byte[] _expectedRandomAdler32 =
{ {
0x37, 0x28, 0xd1, 0x86 0x37, 0x28, 0xd1, 0x86
@@ -342,4 +344,5 @@ public class Aaru
if(result.Where((t, i) => t != _expectedRandomSha512[i]).Any()) if(result.Where((t, i) => t != _expectedRandomSha512[i]).Any())
throw new Exception("Invalid hash value"); throw new Exception("Invalid hash value");
} }
}
} }

View File

@@ -3,10 +3,12 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
namespace AaruBenchmark.Checksums; // ReSharper disable ArrangeNamespaceBody
public class OpenSsl namespace AaruBenchmark.Checksums
{ {
public class OpenSsl
{
static readonly byte[] _expectedRandomMd5 = static readonly byte[] _expectedRandomMd5 =
{ {
0xd7, 0x8f, 0x0e, 0xec, 0x41, 0x7b, 0xe3, 0x86, 0x21, 0x9b, 0x21, 0xb7, 0x00, 0x04, 0x4b, 0x95 0xd7, 0x8f, 0x0e, 0xec, 0x41, 0x7b, 0xe3, 0x86, 0x21, 0x9b, 0x21, 0xb7, 0x00, 0x04, 0x4b, 0x95
@@ -243,4 +245,5 @@ public class OpenSsl
if(hash.Where((t, i) => t != _expectedRandomSha512[i]).Any()) if(hash.Where((t, i) => t != _expectedRandomSha512[i]).Any())
throw new Exception("Invalid hash value"); throw new Exception("Invalid hash value");
} }
}
} }

View File

@@ -3,10 +3,12 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
namespace AaruBenchmark.Checksums; // ReSharper disable ArrangeNamespaceBody
public class RHash namespace AaruBenchmark.Checksums
{ {
public class RHash
{
const uint RHASH_CRC32 = 0x01; const uint RHASH_CRC32 = 0x01;
const uint RHASH_MD5 = 0x04; const uint RHASH_MD5 = 0x04;
const uint RHASH_SHA1 = 0x08; const uint RHASH_SHA1 = 0x08;
@@ -262,4 +264,5 @@ public class RHash
if(hash.Where((t, i) => t != _expectedRandomSha512[i]).Any()) if(hash.Where((t, i) => t != _expectedRandomSha512[i]).Any())
throw new Exception("Invalid hash value"); throw new Exception("Invalid hash value");
} }
}
} }

View File

@@ -1,17 +1,19 @@
using System.IO;
#if NET8_0_OR_GREATER #if NET8_0_OR_GREATER
using Aaru6.Checksums; using Aaru6.Checksums;
#else #else
using Aaru.Checksums; using Aaru.Checksums;
#endif #endif
using System.IO;
using Aaru.Compression; using Aaru.Compression;
using CUETools.Codecs; using CUETools.Codecs;
using CUETools.Codecs.Flake; using CUETools.Codecs.Flake;
namespace AaruBenchmark.Compression; // ReSharper disable ArrangeNamespaceBody
public class Aaru namespace AaruBenchmark.Compression
{ {
public class Aaru
{
public static void AppleRle() public static void AppleRle()
{ {
const int bufferSize = 20960; const int bufferSize = 20960;
@@ -131,4 +133,5 @@ public class Aaru
var audioBuffer = new AudioBuffer(AudioPCMConfig.RedBook, decompressed, 2408448); var audioBuffer = new AudioBuffer(AudioPCMConfig.RedBook, decompressed, 2408448);
flakeWriter.Write(audioBuffer); flakeWriter.Write(audioBuffer);
} }
}
} }

View File

@@ -2,10 +2,12 @@ using System.IO;
using Ionic.BZip2; using Ionic.BZip2;
using Ionic.Zlib; using Ionic.Zlib;
namespace AaruBenchmark.Compression; // ReSharper disable ArrangeNamespaceBody
public static class DotNetZip namespace AaruBenchmark.Compression
{ {
public static class DotNetZip
{
public static void Gzip() public static void Gzip()
{ {
var _dataStream = new FileStream(Path.Combine(Program.Folder, "gzip.gz"), FileMode.Open, FileAccess.Read); var _dataStream = new FileStream(Path.Combine(Program.Folder, "gzip.gz"), FileMode.Open, FileAccess.Read);
@@ -157,4 +159,5 @@ public static class DotNetZip
throw new InvalidDataException("Incorrect decompressed checksum"); throw new InvalidDataException("Incorrect decompressed checksum");
*/ */
} }
}
} }

View File

@@ -1,10 +1,12 @@
using System.IO; using System.IO;
using System.IO.Compression; using System.IO.Compression;
namespace AaruBenchmark.Compression; // ReSharper disable ArrangeNamespaceBody
public static class NetRuntime namespace AaruBenchmark.Compression
{ {
public static class NetRuntime
{
public static void Gzip() public static void Gzip()
{ {
var _dataStream = new FileStream(Path.Combine(Program.Folder, "gzip.gz"), FileMode.Open, FileAccess.Read); var _dataStream = new FileStream(Path.Combine(Program.Folder, "gzip.gz"), FileMode.Open, FileAccess.Read);
@@ -80,4 +82,5 @@ public static class NetRuntime
throw new InvalidDataException("Incorrect decompressed checksum"); throw new InvalidDataException("Incorrect decompressed checksum");
*/ */
} }
}
} }

View File

@@ -1,19 +1,21 @@
using System.IO; using System.IO;
#if NET8_0_OR_GREATER
using Aaru6.Checksums;
#else
using Aaru.Checksums;
#endif
using SharpCompress.Compressors; using SharpCompress.Compressors;
using SharpCompress.Compressors.ADC; using SharpCompress.Compressors.ADC;
using SharpCompress.Compressors.BZip2; using SharpCompress.Compressors.BZip2;
using SharpCompress.Compressors.Deflate; using SharpCompress.Compressors.Deflate;
using SharpCompress.Compressors.LZMA; using SharpCompress.Compressors.LZMA;
#if NET8_0_OR_GREATER
using Aaru6.Checksums;
#else
using Aaru.Checksums;
#endif
namespace AaruBenchmark.Compression; // ReSharper disable ArrangeNamespaceBody
public static class SharpCompress namespace AaruBenchmark.Compression
{ {
public static class SharpCompress
{
public static void Gzip() public static void Gzip()
{ {
var _dataStream = new FileStream(Path.Combine(Program.Folder, "gzip.gz"), FileMode.Open, FileAccess.Read); var _dataStream = new FileStream(Path.Combine(Program.Folder, "gzip.gz"), FileMode.Open, FileAccess.Read);
@@ -353,4 +355,5 @@ public static class SharpCompress
throw new InvalidDataException("Incorrect decompressed checksum"); throw new InvalidDataException("Incorrect decompressed checksum");
*/ */
} }
}
} }

View File

@@ -4,10 +4,12 @@ using System.IO;
using BenchmarkDotNet.Configs; using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Running; using BenchmarkDotNet.Running;
namespace AaruBenchmark; // ReSharper disable ArrangeNamespaceBody
static class Program namespace AaruBenchmark
{ {
static class Program
{
internal static string Folder => Path.Combine(Environment.CurrentDirectory, "data"); internal static string Folder => Path.Combine(Environment.CurrentDirectory, "data");
static void Main(string[] args) static void Main(string[] args)
@@ -42,4 +44,5 @@ static class Program
BenchmarkRunner.Run<Sha512Benchs>(config); BenchmarkRunner.Run<Sha512Benchs>(config);
BenchmarkRunner.Run<SpamSumBenchs>(config); BenchmarkRunner.Run<SpamSumBenchs>(config);
} }
}
} }