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.
70 lines
2.2 KiB
70 lines
2.2 KiB
// <copyright file="Program.cs" company="James Jackson-South">
|
|
// Copyright (c) James Jackson-South and contributors.
|
|
// Licensed under the Apache License, Version 2.0.
|
|
// </copyright>
|
|
|
|
namespace ImageSharp.Sandbox46
|
|
{
|
|
using System;
|
|
using System.Runtime.DesignerServices;
|
|
|
|
using ImageSharp.Benchmarks.Color.Bulk;
|
|
using ImageSharp.Tests;
|
|
|
|
using Xunit.Abstractions;
|
|
|
|
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)
|
|
{
|
|
//RunDecodeJpegProfilingTests();
|
|
TestPixelAccessorCopyFromXyzw();
|
|
Console.ReadLine();
|
|
}
|
|
|
|
private static void TestPixelAccessorCopyFromXyzw()
|
|
{
|
|
PixelAccessorVirtualCopy benchmark = new PixelAccessorVirtualCopy();
|
|
benchmark.Width = 64;
|
|
benchmark.Setup();
|
|
|
|
benchmark.CopyRawUnsafeInlined();
|
|
benchmark.CopyArrayPointerUnsafe();
|
|
benchmark.CopyArrayPointerVirtualUnsafe();
|
|
benchmark.CopyArrayPointerVirtualMarshal();
|
|
|
|
benchmark.Cleanup();
|
|
}
|
|
|
|
private static void RunDecodeJpegProfilingTests()
|
|
{
|
|
Console.WriteLine("RunDecodeJpegProfilingTests...");
|
|
JpegProfilingBenchmarks benchmarks = new JpegProfilingBenchmarks(new ConsoleOutput());
|
|
foreach (object[] data in JpegProfilingBenchmarks.DecodeJpegData)
|
|
{
|
|
string fileName = (string)data[0];
|
|
benchmarks.DecodeJpeg(fileName);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|