- Added MaddoShared.Benchmarks project with BenchmarkDotNet for comprehensive image processing performance tests (parallel, chunk, size, stress). - Included helper for generating test images and custom configs to ensure InProcess toolchain for .NET Windows compatibility. - Added cross-platform scripts to run benchmarks easily. - Updated .gitignore for benchmark artifacts and temp files. - Exposed GetFilesToProcessPublic in ImageCreationStuff for testability. - Added file name sanitization in ImageCreatorSharp to prevent IO errors. - Enhanced WinForms UI: added "Open" buttons for source/destination folders, handled folder opening in Explorer, and improved user messaging and layout. - Updated solution file to include new benchmark project.
35 lines
1.3 KiB
C#
35 lines
1.3 KiB
C#
using BenchmarkDotNet.Configs;
|
|
using BenchmarkDotNet.Jobs;
|
|
using BenchmarkDotNet.Running;
|
|
using BenchmarkDotNet.Toolchains.InProcess.Emit;
|
|
using System;
|
|
using System.Linq;
|
|
|
|
namespace MaddoShared.Benchmarks;
|
|
|
|
internal class Program
|
|
{
|
|
static void Main(string[] args)
|
|
{
|
|
// Check if --job argument is provided
|
|
bool hasJobArg = args.Any(a => a.Contains("--job"));
|
|
|
|
if (hasJobArg)
|
|
{
|
|
Console.WriteLine("Note: Overriding --job argument to use InProcess toolchain");
|
|
Console.WriteLine("This is required to avoid net10.0 vs net10.0-windows compatibility issues.");
|
|
Console.WriteLine();
|
|
|
|
// Remove --job arguments and add our own InProcess config
|
|
args = args.Where(a => !a.StartsWith("--job") && a != "dry" && a != "short").ToArray();
|
|
}
|
|
|
|
// Create configuration that always uses InProcess toolchain
|
|
var config = DefaultConfig.Instance
|
|
.WithOptions(ConfigOptions.DisableOptimizationsValidator)
|
|
.WithOptions(ConfigOptions.KeepBenchmarkFiles);
|
|
|
|
// Run benchmarks - each class has [Config(typeof(InProcessConfig))] which provides InProcess toolchain
|
|
BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args, config);
|
|
}
|
|
}
|