mirror of https://github.com/SixLabors/ImageSharp
Browse Source
Former-commit-id: b49aa6d4012cc28d93b0f2c680d4de6d10aa09bb Former-commit-id: a59176e8bda26889d71fde5d239837bc0994ce79 Former-commit-id: 2a7361abe1a31ab578c0b85d0492eacea12cb8a4pull/1/head
9 changed files with 169 additions and 3 deletions
@ -0,0 +1,20 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
<PropertyGroup> |
|||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion> |
|||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath> |
|||
</PropertyGroup> |
|||
|
|||
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" /> |
|||
<PropertyGroup Label="Globals"> |
|||
<ProjectGuid>299d8e18-102c-42de-adbf-79098ee706a8</ProjectGuid> |
|||
<RootNamespace>ImageProcessorCore.Benchmarks</RootNamespace> |
|||
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath> |
|||
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath> |
|||
</PropertyGroup> |
|||
|
|||
<PropertyGroup> |
|||
<SchemaVersion>2.0</SchemaVersion> |
|||
</PropertyGroup> |
|||
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" /> |
|||
</Project> |
|||
@ -0,0 +1,26 @@ |
|||
namespace ImageProcessorCore.Benchmarks |
|||
{ |
|||
using System; |
|||
using System.Reflection; |
|||
|
|||
using BenchmarkDotNet.Attributes; |
|||
using BenchmarkDotNet.Running; |
|||
using System.Linq; |
|||
|
|||
public class Program |
|||
{ |
|||
public static void Main(string[] args) |
|||
{ |
|||
//Use reflection for a more maintainable way of creating the benchmark switcher,
|
|||
Type[] benchmarks = typeof(Program).Assembly.GetTypes() |
|||
.Where(t => t.GetMethods(BindingFlags.Instance | BindingFlags.Public) |
|||
.Any(m => m.GetCustomAttributes(typeof(BenchmarkAttribute), false).Any())) |
|||
.OrderBy(t => t.Namespace) |
|||
.ThenBy(t => t.Name) |
|||
.ToArray(); |
|||
|
|||
BenchmarkSwitcher benchmarkSwitcher = new BenchmarkSwitcher(benchmarks); |
|||
benchmarkSwitcher.Run(args); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,23 @@ |
|||
using System.Reflection; |
|||
using System.Runtime.CompilerServices; |
|||
using System.Runtime.InteropServices; |
|||
|
|||
// General Information about an assembly is controlled through the following
|
|||
// set of attributes. Change these attribute values to modify the information
|
|||
// associated with an assembly.
|
|||
[assembly: AssemblyTitle("ImageProcessorCore.Benchmarks")] |
|||
[assembly: AssemblyDescription("")] |
|||
[assembly: AssemblyConfiguration("")] |
|||
[assembly: AssemblyCompany("")] |
|||
[assembly: AssemblyProduct("ImageProcessorCore.Benchmarks")] |
|||
[assembly: AssemblyCopyright("Copyright © 2016")] |
|||
[assembly: AssemblyTrademark("")] |
|||
[assembly: AssemblyCulture("")] |
|||
|
|||
// Setting ComVisible to false makes the types in this assembly not visible
|
|||
// to COM components. If you need to access a type in this assembly from
|
|||
// COM, set the ComVisible attribute to true on that type.
|
|||
[assembly: ComVisible(false)] |
|||
|
|||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
|||
[assembly: Guid("299d8e18-102c-42de-adbf-79098ee706a8")] |
|||
@ -0,0 +1,44 @@ |
|||
namespace ImageProcessorCore.Benchmarks |
|||
{ |
|||
using System.Drawing; |
|||
using System.Drawing.Drawing2D; |
|||
|
|||
using BenchmarkDotNet.Attributes; |
|||
|
|||
using ImageProcessorCore.Samplers; |
|||
using CoreImage = ImageProcessorCore.Image; |
|||
using CoreSize = ImageProcessorCore.Size; |
|||
|
|||
public class Resize |
|||
{ |
|||
[Benchmark(Baseline = true, Description = "System Drawing Resize")] |
|||
public Size ResizeSystemDrawing() |
|||
{ |
|||
using (Bitmap source = new Bitmap(400, 400)) |
|||
{ |
|||
using (Bitmap destination = new Bitmap(100, 100)) |
|||
{ |
|||
using (Graphics graphics = Graphics.FromImage(destination)) |
|||
{ |
|||
graphics.InterpolationMode = InterpolationMode.HighQualityBicubic; |
|||
graphics.PixelOffsetMode = PixelOffsetMode.HighQuality; |
|||
graphics.CompositingQuality = CompositingQuality.HighQuality; |
|||
graphics.DrawImage(source, 0, 0, 100, 100); |
|||
} |
|||
|
|||
return destination.Size; |
|||
} |
|||
} |
|||
} |
|||
|
|||
[Benchmark(Description = "ImageProcessor.Core Resize")] |
|||
public CoreSize ResizeCore() |
|||
{ |
|||
using (CoreImage image = new CoreImage(400, 400)) |
|||
{ |
|||
image.Resize(100, 100); |
|||
return new CoreSize(image.Width, image.Height); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,29 @@ |
|||
{ |
|||
"version": "1.0.0-*", |
|||
"description": "ImageProcessorCore.Benchmarks Console Application", |
|||
"authors": [ "James.South" ], |
|||
"tags": [ "" ], |
|||
"projectUrl": "", |
|||
"licenseUrl": "", |
|||
|
|||
"compilationOptions": { |
|||
"emitEntryPoint": true |
|||
}, |
|||
|
|||
"dependencies": { |
|||
"ImageProcessorCore": "1.0.0-*", |
|||
"BenchmarkDotNet": "0.9.5" |
|||
}, |
|||
|
|||
"commands": { |
|||
"ImageProcessorCore.Benchmarks": "ImageProcessorCore.Benchmarks" |
|||
}, |
|||
|
|||
"frameworks": { |
|||
"dnx46": { |
|||
"frameworkAssemblies": { |
|||
"System.Drawing": "4.0.0.0" |
|||
} |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue