From b1578e25bed9cf8f276c5a9ab7e4cdafcafa660a Mon Sep 17 00:00:00 2001 From: Jason Nelson Date: Tue, 3 Jul 2018 09:24:51 -0700 Subject: [PATCH] Remove MethodImplOptions.AggressiveInlining from trival field accessors This JIT, particually with tiering enabled, should already be inlining these. --- src/ImageSharp/ColorSpaces/CieLab.cs | 9 +-------- src/ImageSharp/ColorSpaces/CieLch.cs | 6 +----- src/ImageSharp/ColorSpaces/CieLchuv.cs | 9 +-------- src/ImageSharp/ColorSpaces/CieLuv.cs | 9 +-------- .../ColorSpaces/CieXyChromaticityCoordinates.cs | 3 --- src/ImageSharp/ColorSpaces/CieXyy.cs | 9 +-------- src/ImageSharp/ColorSpaces/CieXyz.cs | 4 ---- src/ImageSharp/ColorSpaces/Cmyk.cs | 1 - src/ImageSharp/ColorSpaces/Hsl.cs | 9 +-------- src/ImageSharp/ColorSpaces/HunterLab.cs | 9 +-------- src/ImageSharp/ColorSpaces/LinearRgb.cs | 9 +-------- src/ImageSharp/ColorSpaces/Lms.cs | 9 +-------- src/ImageSharp/ColorSpaces/Rgb.cs | 9 +-------- src/ImageSharp/ColorSpaces/YCbCr.cs | 6 +----- 14 files changed, 11 insertions(+), 90 deletions(-) diff --git a/src/ImageSharp/ColorSpaces/CieLab.cs b/src/ImageSharp/ColorSpaces/CieLab.cs index 66900079f..9d8d662c8 100644 --- a/src/ImageSharp/ColorSpaces/CieLab.cs +++ b/src/ImageSharp/ColorSpaces/CieLab.cs @@ -83,11 +83,7 @@ namespace SixLabors.ImageSharp.ColorSpaces /// /// Gets the reference white point of this color /// - public CieXyz WhitePoint - { - [MethodImpl(MethodImplOptions.AggressiveInlining)] - get; - } + public CieXyz WhitePoint { get; } /// /// Gets the lightness dimension. @@ -144,7 +140,6 @@ namespace SixLabors.ImageSharp.ColorSpaces /// /// True if the current left is equal to the parameter; otherwise, false. /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool operator ==(CieLab left, CieLab right) { return left.Equals(right); @@ -162,7 +157,6 @@ namespace SixLabors.ImageSharp.ColorSpaces /// /// True if the current left is unequal to the parameter; otherwise, false. /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool operator !=(CieLab left, CieLab right) { return !left.Equals(right); @@ -191,7 +185,6 @@ namespace SixLabors.ImageSharp.ColorSpaces } /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] public override bool Equals(object obj) { return obj is CieLab other && this.Equals(other); diff --git a/src/ImageSharp/ColorSpaces/CieLch.cs b/src/ImageSharp/ColorSpaces/CieLch.cs index 57ed5f48d..521e647e4 100644 --- a/src/ImageSharp/ColorSpaces/CieLch.cs +++ b/src/ImageSharp/ColorSpaces/CieLch.cs @@ -83,11 +83,7 @@ namespace SixLabors.ImageSharp.ColorSpaces /// /// Gets the reference white point of this color /// - public CieXyz WhitePoint - { - [MethodImpl(MethodImplOptions.AggressiveInlining)] - get; - } + public CieXyz WhitePoint { get; } /// /// Gets the lightness dimension. diff --git a/src/ImageSharp/ColorSpaces/CieLchuv.cs b/src/ImageSharp/ColorSpaces/CieLchuv.cs index a378aae86..682d7f2e4 100644 --- a/src/ImageSharp/ColorSpaces/CieLchuv.cs +++ b/src/ImageSharp/ColorSpaces/CieLchuv.cs @@ -83,11 +83,7 @@ namespace SixLabors.ImageSharp.ColorSpaces /// /// Gets the reference white point of this color /// - public CieXyz WhitePoint - { - [MethodImpl(MethodImplOptions.AggressiveInlining)] - get; - } + public CieXyz WhitePoint { get; } /// /// Gets the lightness dimension. @@ -144,7 +140,6 @@ namespace SixLabors.ImageSharp.ColorSpaces /// /// True if the current left is equal to the parameter; otherwise, false. /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool operator ==(CieLchuv left, CieLchuv right) { return left.Equals(right); @@ -162,7 +157,6 @@ namespace SixLabors.ImageSharp.ColorSpaces /// /// True if the current left is unequal to the parameter; otherwise, false. /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool operator !=(CieLchuv left, CieLchuv right) { return !left.Equals(right); @@ -191,7 +185,6 @@ namespace SixLabors.ImageSharp.ColorSpaces } /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] public override bool Equals(object obj) { return obj is CieLchuv other && this.Equals(other); diff --git a/src/ImageSharp/ColorSpaces/CieLuv.cs b/src/ImageSharp/ColorSpaces/CieLuv.cs index f93e1fd46..60827e4aa 100644 --- a/src/ImageSharp/ColorSpaces/CieLuv.cs +++ b/src/ImageSharp/ColorSpaces/CieLuv.cs @@ -85,11 +85,7 @@ namespace SixLabors.ImageSharp.ColorSpaces /// /// Gets the reference white point of this color /// - public CieXyz WhitePoint - { - [MethodImpl(MethodImplOptions.AggressiveInlining)] - get; - } + public CieXyz WhitePoint { get; } /// /// Gets the lightness dimension @@ -146,7 +142,6 @@ namespace SixLabors.ImageSharp.ColorSpaces /// /// True if the current left is equal to the parameter; otherwise, false. /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool operator ==(CieLuv left, CieLuv right) { return left.Equals(right); @@ -164,7 +159,6 @@ namespace SixLabors.ImageSharp.ColorSpaces /// /// True if the current left is unequal to the parameter; otherwise, false. /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool operator !=(CieLuv left, CieLuv right) { return !left.Equals(right); @@ -193,7 +187,6 @@ namespace SixLabors.ImageSharp.ColorSpaces } /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] public override bool Equals(object obj) { return obj is CieLuv other && this.Equals(other); diff --git a/src/ImageSharp/ColorSpaces/CieXyChromaticityCoordinates.cs b/src/ImageSharp/ColorSpaces/CieXyChromaticityCoordinates.cs index 6716b1bad..10a251420 100644 --- a/src/ImageSharp/ColorSpaces/CieXyChromaticityCoordinates.cs +++ b/src/ImageSharp/ColorSpaces/CieXyChromaticityCoordinates.cs @@ -105,7 +105,6 @@ namespace SixLabors.ImageSharp.ColorSpaces /// /// True if the current left is unequal to the parameter; otherwise, false. /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool operator !=(CieXyChromaticityCoordinates left, CieXyChromaticityCoordinates right) { return !left.Equals(right); @@ -129,14 +128,12 @@ namespace SixLabors.ImageSharp.ColorSpaces } /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] public override bool Equals(object obj) { return obj is CieXyChromaticityCoordinates other && this.Equals(other); } /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] public bool Equals(CieXyChromaticityCoordinates other) { // The memberwise comparison here is a workaround for https://github.com/dotnet/coreclr/issues/16443 diff --git a/src/ImageSharp/ColorSpaces/CieXyy.cs b/src/ImageSharp/ColorSpaces/CieXyy.cs index 71ad4701a..690b3fcfc 100644 --- a/src/ImageSharp/ColorSpaces/CieXyy.cs +++ b/src/ImageSharp/ColorSpaces/CieXyy.cs @@ -85,11 +85,7 @@ namespace SixLabors.ImageSharp.ColorSpaces public bool IsEmpty => this.Equals(Empty); /// - public Vector3 Vector - { - [MethodImpl(MethodImplOptions.AggressiveInlining)] - get => this.backingVector; - } + public Vector3 Vector => this.backingVector; /// /// Compares two objects for equality. @@ -103,7 +99,6 @@ namespace SixLabors.ImageSharp.ColorSpaces /// /// True if the current left is equal to the parameter; otherwise, false. /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool operator ==(CieXyy left, CieXyy right) { return left.Equals(right); @@ -121,7 +116,6 @@ namespace SixLabors.ImageSharp.ColorSpaces /// /// True if the current left is unequal to the parameter; otherwise, false. /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool operator !=(CieXyy left, CieXyy right) { return !left.Equals(right); @@ -145,7 +139,6 @@ namespace SixLabors.ImageSharp.ColorSpaces } /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] public override bool Equals(object obj) { return obj is CieXyy other && this.Equals(other); diff --git a/src/ImageSharp/ColorSpaces/CieXyz.cs b/src/ImageSharp/ColorSpaces/CieXyz.cs index 79676bb08..fec4c74e2 100644 --- a/src/ImageSharp/ColorSpaces/CieXyz.cs +++ b/src/ImageSharp/ColorSpaces/CieXyz.cs @@ -40,7 +40,6 @@ namespace SixLabors.ImageSharp.ColorSpaces /// Initializes a new instance of the struct. /// /// The vector representing the x, y, z components. - [MethodImpl(MethodImplOptions.AggressiveInlining)] public CieXyz(Vector3 vector) : this() { @@ -103,7 +102,6 @@ namespace SixLabors.ImageSharp.ColorSpaces /// /// True if the current left is equal to the parameter; otherwise, false. /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool operator ==(CieXyz left, CieXyz right) { return left.Equals(right); @@ -121,7 +119,6 @@ namespace SixLabors.ImageSharp.ColorSpaces /// /// True if the current left is unequal to the parameter; otherwise, false. /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool operator !=(CieXyz left, CieXyz right) { return !left.Equals(right); @@ -145,7 +142,6 @@ namespace SixLabors.ImageSharp.ColorSpaces } /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] public override bool Equals(object obj) { return obj is CieXyz other && this.Equals(other); diff --git a/src/ImageSharp/ColorSpaces/Cmyk.cs b/src/ImageSharp/ColorSpaces/Cmyk.cs index 989d512bb..ffbe2e265 100644 --- a/src/ImageSharp/ColorSpaces/Cmyk.cs +++ b/src/ImageSharp/ColorSpaces/Cmyk.cs @@ -147,7 +147,6 @@ namespace SixLabors.ImageSharp.ColorSpaces } /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] public override bool Equals(object obj) { return obj is Cmyk other && this.Equals(other); diff --git a/src/ImageSharp/ColorSpaces/Hsl.cs b/src/ImageSharp/ColorSpaces/Hsl.cs index 88b14fa97..31b93d384 100644 --- a/src/ImageSharp/ColorSpaces/Hsl.cs +++ b/src/ImageSharp/ColorSpaces/Hsl.cs @@ -87,11 +87,7 @@ namespace SixLabors.ImageSharp.ColorSpaces public bool IsEmpty => this.Equals(Empty); /// - public Vector3 Vector - { - [MethodImpl(MethodImplOptions.AggressiveInlining)] - get => this.backingVector; - } + public Vector3 Vector => this.backingVector; /// /// Compares two objects for equality. @@ -105,7 +101,6 @@ namespace SixLabors.ImageSharp.ColorSpaces /// /// True if the current left is equal to the parameter; otherwise, false. /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool operator ==(Hsl left, Hsl right) { return left.Equals(right); @@ -123,7 +118,6 @@ namespace SixLabors.ImageSharp.ColorSpaces /// /// True if the current left is unequal to the parameter; otherwise, false. /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool operator !=(Hsl left, Hsl right) { return !left.Equals(right); @@ -147,7 +141,6 @@ namespace SixLabors.ImageSharp.ColorSpaces } /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] public override bool Equals(object obj) { return obj is Hsl other && this.Equals(other); diff --git a/src/ImageSharp/ColorSpaces/HunterLab.cs b/src/ImageSharp/ColorSpaces/HunterLab.cs index 4395d9d7c..9197be32e 100644 --- a/src/ImageSharp/ColorSpaces/HunterLab.cs +++ b/src/ImageSharp/ColorSpaces/HunterLab.cs @@ -122,11 +122,7 @@ namespace SixLabors.ImageSharp.ColorSpaces public bool IsEmpty => this.Equals(Empty); /// - public Vector3 Vector - { - [MethodImpl(MethodImplOptions.AggressiveInlining)] - get => this.backingVector; - } + public Vector3 Vector => this.backingVector; /// /// Compares two objects for equality. @@ -140,7 +136,6 @@ namespace SixLabors.ImageSharp.ColorSpaces /// /// True if the current left is equal to the parameter; otherwise, false. /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool operator ==(HunterLab left, HunterLab right) { return left.Equals(right); @@ -158,7 +153,6 @@ namespace SixLabors.ImageSharp.ColorSpaces /// /// True if the current left is unequal to the parameter; otherwise, false. /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool operator !=(HunterLab left, HunterLab right) { return !left.Equals(right); @@ -187,7 +181,6 @@ namespace SixLabors.ImageSharp.ColorSpaces } /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] public override bool Equals(object obj) { return obj is HunterLab other && this.Equals(other); diff --git a/src/ImageSharp/ColorSpaces/LinearRgb.cs b/src/ImageSharp/ColorSpaces/LinearRgb.cs index c721347be..f66527266 100644 --- a/src/ImageSharp/ColorSpaces/LinearRgb.cs +++ b/src/ImageSharp/ColorSpaces/LinearRgb.cs @@ -119,11 +119,7 @@ namespace SixLabors.ImageSharp.ColorSpaces public bool IsEmpty => this.Equals(Empty); /// - public Vector3 Vector - { - [MethodImpl(MethodImplOptions.AggressiveInlining)] - get => this.backingVector; - } + public Vector3 Vector => this.backingVector; /// /// Compares two objects for equality. @@ -137,7 +133,6 @@ namespace SixLabors.ImageSharp.ColorSpaces /// /// True if the current left is equal to the parameter; otherwise, false. /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool operator ==(LinearRgb left, LinearRgb right) { return left.Equals(right); @@ -155,7 +150,6 @@ namespace SixLabors.ImageSharp.ColorSpaces /// /// True if the current left is unequal to the parameter; otherwise, false. /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool operator !=(LinearRgb left, LinearRgb right) { return !left.Equals(right); @@ -179,7 +173,6 @@ namespace SixLabors.ImageSharp.ColorSpaces } /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] public override bool Equals(object obj) { return obj is LinearRgb other && this.Equals(other); diff --git a/src/ImageSharp/ColorSpaces/Lms.cs b/src/ImageSharp/ColorSpaces/Lms.cs index e46249569..81a068d50 100644 --- a/src/ImageSharp/ColorSpaces/Lms.cs +++ b/src/ImageSharp/ColorSpaces/Lms.cs @@ -86,11 +86,7 @@ namespace SixLabors.ImageSharp.ColorSpaces public bool IsEmpty => this.Equals(Empty); /// - public Vector3 Vector - { - [MethodImpl(MethodImplOptions.AggressiveInlining)] - get => this.backingVector; - } + public Vector3 Vector => this.backingVector; /// /// Compares two objects for equality. @@ -104,7 +100,6 @@ namespace SixLabors.ImageSharp.ColorSpaces /// /// True if the current left is equal to the parameter; otherwise, false. /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool operator ==(Lms left, Lms right) { return left.Equals(right); @@ -122,7 +117,6 @@ namespace SixLabors.ImageSharp.ColorSpaces /// /// True if the current left is unequal to the parameter; otherwise, false. /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool operator !=(Lms left, Lms right) { return !left.Equals(right); @@ -146,7 +140,6 @@ namespace SixLabors.ImageSharp.ColorSpaces } /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] public override bool Equals(object obj) { return obj is Lms other && this.Equals(other); diff --git a/src/ImageSharp/ColorSpaces/Rgb.cs b/src/ImageSharp/ColorSpaces/Rgb.cs index 8cdf54ace..351d2b187 100644 --- a/src/ImageSharp/ColorSpaces/Rgb.cs +++ b/src/ImageSharp/ColorSpaces/Rgb.cs @@ -125,11 +125,7 @@ namespace SixLabors.ImageSharp.ColorSpaces public bool IsEmpty => this.Equals(Empty); /// - public Vector3 Vector - { - [MethodImpl(MethodImplOptions.AggressiveInlining)] - get => this.backingVector; - } + public Vector3 Vector => this.backingVector; /// /// Allows the implicit conversion of an instance of to a @@ -159,7 +155,6 @@ namespace SixLabors.ImageSharp.ColorSpaces /// /// True if the current left is equal to the parameter; otherwise, false. /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool operator ==(Rgb left, Rgb right) { return left.Equals(right); @@ -177,7 +172,6 @@ namespace SixLabors.ImageSharp.ColorSpaces /// /// True if the current left is unequal to the parameter; otherwise, false. /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool operator !=(Rgb left, Rgb right) { return !left.Equals(right); @@ -201,7 +195,6 @@ namespace SixLabors.ImageSharp.ColorSpaces } /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] public override bool Equals(object obj) { return obj is Rgb other && this.Equals(other); diff --git a/src/ImageSharp/ColorSpaces/YCbCr.cs b/src/ImageSharp/ColorSpaces/YCbCr.cs index 2c3feffa9..cb1060137 100644 --- a/src/ImageSharp/ColorSpaces/YCbCr.cs +++ b/src/ImageSharp/ColorSpaces/YCbCr.cs @@ -89,11 +89,7 @@ namespace SixLabors.ImageSharp.ColorSpaces public bool IsEmpty => this.Equals(Empty); /// - public Vector3 Vector - { - [MethodImpl(MethodImplOptions.AggressiveInlining)] - get => this.backingVector; - } + public Vector3 Vector => this.backingVector; /// /// Compares two objects for equality.