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

View File

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

View File

@@ -3,10 +3,12 @@ using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
namespace AaruBenchmark.Checksums;
// ReSharper disable ArrangeNamespaceBody
public class OpenSsl
namespace AaruBenchmark.Checksums
{
public class OpenSsl
{
static readonly byte[] _expectedRandomMd5 =
{
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())
throw new Exception("Invalid hash value");
}
}
}

View File

@@ -3,10 +3,12 @@ using System.IO;
using System.Linq;
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_MD5 = 0x04;
const uint RHASH_SHA1 = 0x08;
@@ -262,4 +264,5 @@ public class RHash
if(hash.Where((t, i) => t != _expectedRandomSha512[i]).Any())
throw new Exception("Invalid hash value");
}
}
}

View File

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

View File

@@ -2,10 +2,12 @@ using System.IO;
using Ionic.BZip2;
using Ionic.Zlib;
namespace AaruBenchmark.Compression;
// ReSharper disable ArrangeNamespaceBody
public static class DotNetZip
namespace AaruBenchmark.Compression
{
public static class DotNetZip
{
public static void Gzip()
{
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");
*/
}
}
}

View File

@@ -1,10 +1,12 @@
using System.IO;
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()
{
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");
*/
}
}
}

View File

@@ -1,19 +1,21 @@
using System.IO;
#if NET8_0_OR_GREATER
using Aaru6.Checksums;
#else
using Aaru.Checksums;
#endif
using SharpCompress.Compressors;
using SharpCompress.Compressors.ADC;
using SharpCompress.Compressors.BZip2;
using SharpCompress.Compressors.Deflate;
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()
{
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");
*/
}
}
}

View File

@@ -4,10 +4,12 @@ using System.IO;
using BenchmarkDotNet.Configs;
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");
static void Main(string[] args)
@@ -42,4 +44,5 @@ static class Program
BenchmarkRunner.Run<Sha512Benchs>(config);
BenchmarkRunner.Run<SpamSumBenchs>(config);
}
}
}