Skip to content

Instantly share code, notes, and snippets.

                     Method | InputSize |          Mean |    StdErr |     StdDev | Scaled | Scaled-StdDev |

------------------------------- |---------- |-------------- |---------- |----------- |------- |-------------- | StandardArrays | 16 | 56.4556 ns | 0.2660 ns | 0.9953 ns | 1.00 | 0.00 | BatchedArrays | 16 | 57.7315 ns | 0.5755 ns | 2.3020 ns | 1.02 | 0.04 | StandardSpans | 16 | 78.0805 ns | 0.7939 ns | 3.4607 ns | 1.38 | 0.06 | StandardSpansMainCallIsInlined | 16 | 73.5502 ns | 0.3201 ns | 1.1978 ns | 1.30 | 0.03 | BatchedSpans | 16 | 79.5698 ns | 0.6289 ns | 2.4357 ns | 1.41 | 0.05 | BatchedPointers | 16 | 50.4953 ns | 0.2697 ns | 1.0093 ns | 0.89 | 0.02 | | | | | | | | StandardArrays | 64 | 241.3820 ns | 2.0609 ns |

using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;
using OurVerySecretLib.MathF.LinearAlgebra;
using System.Globalization;
using M = System.Math;
namespace OurVerySecretLib.MathF
{
      Method | InputSize |          Mean |    StdDev | Scaled | Scaled-StdDev |

---------------- |---------- |-------------- |---------- |------- |-------------- | Standard | 16 | 55.6822 ns | 0.1794 ns | 1.00 | 0.00 | Bithack | 16 | 143.3762 ns | 0.4225 ns | 2.57 | 0.01 | BithackBatched | 16 | 110.5777 ns | 7.4833 ns | 1.99 | 0.13 | BatchedPointers | 16 | 49.9270 ns | 0.1580 ns | 0.90 | 0.00 | | | | | | | Standard | 64 | 234.1635 ns | 0.7504 ns | 1.00 | 0.00 | Bithack | 64 | 576.1446 ns | 1.0512 ns | 2.46 | 0.01 | BithackBatched | 64 | 214.5398 ns | 0.4343 ns | 0.92 | 0.00 |

Reisize original:

                  Method |       Mean |    StdErr |    StdDev | Scaled | Scaled-StdDev | Allocated |

---------------------------- |----------- |---------- |---------- |------- |-------------- |---------- | 'System.Drawing Resize' | 55.7482 ms | 0.6225 ms | 2.4109 ms | 1.00 | 0.00 | 512 B | 'ImageSharp Resize' | 28.7155 ms | 0.0552 ms | 0.2138 ms | 0.52 | 0.02 | 187.04 kB | 'ImageSharp Compand Resize' | 58.1706 ms | 0.3284 ms | 1.2717 ms | 1.05 | 0.05 | 186.67 kB |

After:

public interface IClipboardFormat
{
string FormatName { get; }
}
public interface IClipboard
{
void SetData(IClipboardFormat format, object data);
object GetData(IClipboardFormat format);
}
public interface IClipboardFormat
{
string FormatName { get; }
}
public interface IClipboard
{
void SetData(IClipboardFormat format, object data);
object GetData(IClipboardFormat format);
}
namespace ImageSharp
{
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
/// <summary>
/// One interface to rule them all
/// </summary>
@antonfirsov
antonfirsov / BulkPixelsV2.cs
Last active February 16, 2017 23:22
BulkPixelOperations with UnsafeSpan
/// <summary>
/// Since System.Span<T> fails to perform fast (and it will keep being slow for a long time on non-CoreCLR platforms),
/// we need to our own library-wide "semi-safe" solution.
/// It has many advantages over passing void* pointers and/or array+indexer pairs.
/// </summary>
public unsafe struct UnsafeSpan<T> where T : struct
{
public T[] Data { get; }
public int Offset { get; }
// <copyright file="Array2D.cs" company="James Jackson-South">
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
// </copyright>
namespace ImageSharp.Benchmarks.General
{
using System;
using BenchmarkDotNet.Attributes;
                          Method | Count |       Mean |    StdErr |    StdDev | Scaled | Scaled-StdDev |

------------------------------------ |------ |----------- |---------- |---------- |------- |-------------- | FlatArrayIndex | 4 | 12.4112 ns | 0.1515 ns | 0.6061 ns | 0.63 | 0.03 | 'Array access using 2D array' | 4 | 19.6437 ns | 0.0178 ns | 0.0689 ns | 1.00 | 0.00 | 'Array access using a jagged array' | 4 | 16.3029 ns | 0.0202 ns | 0.0781 ns | 0.83 | 0.00 | 'Array access using Fast2DArray' | 4 | 12.5566 ns | 0.0190 ns | 0.0658 ns | 0.64 | 0.00 | FlatArrayIndex | 16 | 12.8350 ns | 0.1215 ns | 0.4707 ns | 0.63 | 0.03 | 'Array access using 2D array' | 16 | 20.3895 ns | 0.2246 ns | 0.8700 ns | 1.00 | 0.00 | 'Array access using a jagged array' | 16 | 16.2835 ns | 0.0276 ns | 0.1068 ns | 0.80 | 0.03 |