mirror of https://github.com/SixLabors/ImageSharp
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
79 lines
2.8 KiB
79 lines
2.8 KiB
using System;
|
|
using SixLabors.ImageSharp.Tests.Formats.Jpg;
|
|
using SixLabors.ImageSharp.Tests.PixelFormats.PixelOperations;
|
|
using SixLabors.ImageSharp.Tests.ProfilingBenchmarks;
|
|
using Xunit.Abstractions;
|
|
|
|
// in this file, comments are used for disabling stuff for local execution
|
|
#pragma warning disable SA1515
|
|
#pragma warning disable SA1512
|
|
|
|
namespace SixLabors.ImageSharp.Tests.ProfilingSandbox
|
|
{
|
|
public class Program
|
|
{
|
|
private class ConsoleOutput : ITestOutputHelper
|
|
{
|
|
public void WriteLine(string message) => Console.WriteLine(message);
|
|
|
|
public void WriteLine(string format, params object[] args) => Console.WriteLine(format, args);
|
|
}
|
|
|
|
/// <summary>
|
|
/// The main entry point. Useful for executing benchmarks and performance unit tests manually,
|
|
/// when the IDE test runners lack some of the functionality. Eg.: it's not possible to run JetBrains memory profiler for unit tests.
|
|
/// </summary>
|
|
/// <param name="args">
|
|
/// The arguments to pass to the program.
|
|
/// </param>
|
|
public static void Main(string[] args)
|
|
{
|
|
LoadResizeSaveParallelMemoryStress.Run();
|
|
// RunJpegEncoderProfilingTests();
|
|
// RunJpegColorProfilingTests();
|
|
// RunDecodeJpegProfilingTests();
|
|
// RunToVector4ProfilingTest();
|
|
// RunResizeProfilingTest();
|
|
|
|
// Console.ReadLine();
|
|
}
|
|
|
|
private static void RunJpegEncoderProfilingTests()
|
|
{
|
|
var benchmarks = new JpegProfilingBenchmarks(new ConsoleOutput());
|
|
benchmarks.EncodeJpeg_SingleMidSize();
|
|
}
|
|
|
|
private static void RunJpegColorProfilingTests()
|
|
{
|
|
new JpegColorConverterTests(new ConsoleOutput()).BenchmarkYCbCr(false);
|
|
new JpegColorConverterTests(new ConsoleOutput()).BenchmarkYCbCr(true);
|
|
}
|
|
|
|
private static void RunResizeProfilingTest()
|
|
{
|
|
var test = new ResizeProfilingBenchmarks(new ConsoleOutput());
|
|
test.ResizeBicubic(4000, 4000);
|
|
}
|
|
|
|
private static void RunToVector4ProfilingTest()
|
|
{
|
|
var tests = new PixelOperationsTests.Rgba32_OperationsTests(new ConsoleOutput());
|
|
tests.Benchmark_ToVector4();
|
|
}
|
|
|
|
private static void RunDecodeJpegProfilingTests()
|
|
{
|
|
Console.WriteLine("RunDecodeJpegProfilingTests...");
|
|
var benchmarks = new JpegProfilingBenchmarks(new ConsoleOutput());
|
|
foreach (object[] data in JpegProfilingBenchmarks.DecodeJpegData)
|
|
{
|
|
string fileName = (string)data[0];
|
|
int executionCount = (int)data[1];
|
|
benchmarks.DecodeJpeg(fileName, executionCount);
|
|
}
|
|
|
|
Console.WriteLine("DONE.");
|
|
}
|
|
}
|
|
}
|
|
|