From ef76cbed8cb6ffca745aa0e339b4663a6375dc37 Mon Sep 17 00:00:00 2001 From: Andrei Sergeev Date: Tue, 24 Dec 2024 23:59:14 +0400 Subject: [PATCH] OptionalLinq: Add AggressiveInlining to high-level inner methods --- .../OptionalLinqExtensions/Inner/InnerElementAtOrAbsent.cs | 3 +++ .../OptionalLinqExtensions/Inner/InnerFirstOrAbsent.cs | 3 +++ .../OptionalLinqExtensions/Inner/InnerGetValueOrAbsent.cs | 2 ++ .../Optional/OptionalLinqExtensions/Inner/InnerLastOrAbsent.cs | 3 +++ .../OptionalLinqExtensions/Inner/InnerSingleOrAbsent.cs | 3 +++ 5 files changed, 14 insertions(+) diff --git a/src/core-taggeds-optional/Optional/OptionalLinqExtensions/Inner/InnerElementAtOrAbsent.cs b/src/core-taggeds-optional/Optional/OptionalLinqExtensions/Inner/InnerElementAtOrAbsent.cs index 00388d9a..2cffcf44 100644 --- a/src/core-taggeds-optional/Optional/OptionalLinqExtensions/Inner/InnerElementAtOrAbsent.cs +++ b/src/core-taggeds-optional/Optional/OptionalLinqExtensions/Inner/InnerElementAtOrAbsent.cs @@ -1,9 +1,11 @@ using System.Collections.Generic; +using System.Runtime.CompilerServices; namespace System.Linq; partial class OptionalLinqExtensions { + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static Optional InnerElementAtOrAbsent( this IEnumerable source, Index index) @@ -23,6 +25,7 @@ IList list : source.InnerElementAtOrAbsent_IEnumerable_FromEnd(index.Value) }; + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static Optional InnerElementAtOrAbsent( this IEnumerable source, int index) diff --git a/src/core-taggeds-optional/Optional/OptionalLinqExtensions/Inner/InnerFirstOrAbsent.cs b/src/core-taggeds-optional/Optional/OptionalLinqExtensions/Inner/InnerFirstOrAbsent.cs index 88362430..e0f7dff7 100644 --- a/src/core-taggeds-optional/Optional/OptionalLinqExtensions/Inner/InnerFirstOrAbsent.cs +++ b/src/core-taggeds-optional/Optional/OptionalLinqExtensions/Inner/InnerFirstOrAbsent.cs @@ -1,9 +1,11 @@ using System.Collections.Generic; +using System.Runtime.CompilerServices; namespace System.Linq; partial class OptionalLinqExtensions { + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static Optional InnerFirstOrAbsent( this IEnumerable source) => @@ -21,6 +23,7 @@ IList list source.InnerFirstOrAbsent_IEnumerable() }; + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static Optional InnerFirstOrAbsent( this IEnumerable source, Func predicate) diff --git a/src/core-taggeds-optional/Optional/OptionalLinqExtensions/Inner/InnerGetValueOrAbsent.cs b/src/core-taggeds-optional/Optional/OptionalLinqExtensions/Inner/InnerGetValueOrAbsent.cs index 6c05759b..1518eb7b 100644 --- a/src/core-taggeds-optional/Optional/OptionalLinqExtensions/Inner/InnerGetValueOrAbsent.cs +++ b/src/core-taggeds-optional/Optional/OptionalLinqExtensions/Inner/InnerGetValueOrAbsent.cs @@ -1,9 +1,11 @@ using System.Collections.Generic; +using System.Runtime.CompilerServices; namespace System.Linq; partial class OptionalLinqExtensions { + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static Optional InnerGetValueOrAbsent( this IEnumerable> pairs, TKey key) diff --git a/src/core-taggeds-optional/Optional/OptionalLinqExtensions/Inner/InnerLastOrAbsent.cs b/src/core-taggeds-optional/Optional/OptionalLinqExtensions/Inner/InnerLastOrAbsent.cs index 2abb11b3..04afac86 100644 --- a/src/core-taggeds-optional/Optional/OptionalLinqExtensions/Inner/InnerLastOrAbsent.cs +++ b/src/core-taggeds-optional/Optional/OptionalLinqExtensions/Inner/InnerLastOrAbsent.cs @@ -1,9 +1,11 @@ using System.Collections.Generic; +using System.Runtime.CompilerServices; namespace System.Linq; partial class OptionalLinqExtensions { + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static Optional InnerLastOrAbsent( this IEnumerable source) => @@ -21,6 +23,7 @@ IList list source.InnerLastOrAbsent_IEnumerable() }; + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static Optional InnerLastOrAbsent( this IEnumerable source, Func predicate) diff --git a/src/core-taggeds-optional/Optional/OptionalLinqExtensions/Inner/InnerSingleOrAbsent.cs b/src/core-taggeds-optional/Optional/OptionalLinqExtensions/Inner/InnerSingleOrAbsent.cs index 9ee91b2e..c5a74ad8 100644 --- a/src/core-taggeds-optional/Optional/OptionalLinqExtensions/Inner/InnerSingleOrAbsent.cs +++ b/src/core-taggeds-optional/Optional/OptionalLinqExtensions/Inner/InnerSingleOrAbsent.cs @@ -1,9 +1,11 @@ using System.Collections.Generic; +using System.Runtime.CompilerServices; namespace System.Linq; partial class OptionalLinqExtensions { + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static Optional InnerSingleOrAbsent( this IEnumerable source, Func moreThanOneElementExceptionFactory) @@ -22,6 +24,7 @@ IList list source.InnerSingleOrAbsent_IEnumerable(moreThanOneElementExceptionFactory) }; + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static Optional InnerSingleOrAbsent( this IEnumerable source, Func predicate,