Browse Source

inlining

af/merge-core
Anton Firszov 9 years ago
parent
commit
81ce9f5977
  1. 2
      src/ImageSharp/Colors/Color.BulkOperations.cs
  2. 2
      src/ImageSharp/Common/Memory/BufferPointer.cs
  3. 4
      src/ImageSharp/Common/Memory/PinnedBuffer{T}.cs

2
src/ImageSharp/Colors/Color.BulkOperations.cs

@ -66,7 +66,7 @@ namespace ImageSharp
for (; src < srcEnd; src++, dst++)
{
// TODO: We can benefit a lot of future Vector<T> API-s here (https://github.com/dotnet/corefx/issues/15957)
// TODO: This is the bottleneck now. We can improve it with future Vector<T> API-s (https://github.com/dotnet/corefx/issues/15957)
dst->Load(*src);
}

2
src/ImageSharp/Common/Memory/BufferPointer.cs

@ -16,7 +16,7 @@ namespace ImageSharp
internal static class BufferPointer
{
/// <summary>
/// It's worth to use Marshal.Copy() over this size.
/// It's worth to use Marshal.Copy() or Buffer.BlockCopy() over this size.
/// </summary>
private const int ByteCountThreshold = 1024;

4
src/ImageSharp/Common/Memory/PinnedBuffer{T}.cs

@ -142,6 +142,7 @@ namespace ImageSharp
/// <summary>
/// Disposes the <see cref="PinnedBuffer{T}"/> instance by unpinning the array, and returning the pooled buffer when necessary.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Dispose()
{
if (this.IsDisposedOrLostArrayOwnership)
@ -165,6 +166,7 @@ namespace ImageSharp
/// If <see cref="Array"/> is rented, it's the callers responsibility to return it to it's pool. (Most likely <see cref="PixelDataPool{T}"/>)
/// </summary>
/// <returns>The unpinned <see cref="Array"/></returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public T[] UnPinAndTakeArrayOwnership()
{
if (this.IsDisposedOrLostArrayOwnership)
@ -182,6 +184,7 @@ namespace ImageSharp
/// <summary>
/// Pins <see cref="Array"/>.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private void Pin()
{
this.handle = GCHandle.Alloc(this.Array, GCHandleType.Pinned);
@ -191,6 +194,7 @@ namespace ImageSharp
/// <summary>
/// Unpins <see cref="Array"/>.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private void UnPin()
{
if (this.Pointer == IntPtr.Zero || !this.handle.IsAllocated)

Loading…
Cancel
Save