Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

- Convert SumF functions for Array, Span, and List into a generic function #20

Open
wants to merge 30 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift click to select a range
666f1fa
- Convert SumF function into a generic function
Jul 30, 2019
cf405ac
SumF for an Array
Jul 31, 2019
4eb6b16
- Split the Sum types out
Jul 31, 2019
71459b2
- Fix float selector special case
Jul 31, 2019
8ee3849
[Enhancement] Can these API's also work on IList<T> #15
Jul 31, 2019
cb6ce9d
- Add Nullable types for List and IList
Jul 31, 2019
d6a2542
- Use "IList fast redirect" to implement all average Base and Nullabl…
Jul 31, 2019
3ecde38
- Complete base types applicable to Span<T>
Jul 31, 2019
e93f373
Fix #21: [Bug] `Span SumF` is slower than a for loop over a span
Aug 1, 2019
fed5794
[Enhancement] Can these API's also work on IList<T> #15
Aug 1, 2019
d3b706e
[Enhancement] Can these API's also work on IList<T> #15
Aug 1, 2019
1e464b9
Investigate #22: [Question] Span_FirstF and List_First are slower tha…
Aug 2, 2019
81c2a40
Investigate #22: [Question] Span_FirstF and List_FirstF are slower th…
Aug 2, 2019
b762eff
Investigate #15: [Enhancement] Can these API's also work on IReadOnly…
Aug 5, 2019
ac38801
More for #15: [Enhancement] Can these API's also work on IReadOnlyLis…
Aug 5, 2019
57932a1
Initial commit for #24: [Enhancement] DefaultIfEmptyF should be imple…
Aug 5, 2019
c7652e0
MaxF's for #15 : [Enhancement] Can these API's also work on IReadOnl…
Aug 6, 2019
54e72fa
MinF's for #15 : [Enhancement] Can these API's also work on IReadOnl…
Aug 6, 2019
c3669bf
WhereSumF's for #15 : [Enhancement] Can these API's also work on IRe…
Aug 6, 2019
ce954e2
- Note: Lists can have items added and removed whilst these API's are…
Aug 6, 2019
3bafae3
Invesigate #25: [Enhancement] Please also target .net4.8 and Benchmark
Aug 7, 2019
9c9dd9d
Investigate #25: [Enhancement] Please also target .net4.8 and Benchmark
Aug 7, 2019
fb43c8c
Investigate #21: [Bug] Span SumF is slower than a for loop over a span
Aug 8, 2019
25c68fc
- Attempt to fic AppVeyor
Aug 8, 2019
064760c
- Another Attempt to satisfy Appveyor
Aug 8, 2019
66e84c4
- Appveyor again - Reset the bindingRedirects
Aug 8, 2019
1963489
- Look Apveyor Use the correct system.memry version will ya !
Aug 8, 2019
37f256c
- (Maybe) Seems like the App.config is being ignored, so be explicit …
Aug 8, 2019
5927bcb
- Fix weird "Sometimes failing" test that show aggressive inlining do…
Aug 8, 2019
5db00ad
- test the unit Test Again !
Aug 8, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Initial commit for #24: [Enhancement] DefaultIfEmptyF should be imple…
…mented

- Add Start File
  • Loading branch information
Smurf-IV committed Aug 5, 2019
commit 57932a129b798fa77c25c8e301f85d0702a6f64b
29 changes: 29 additions & 0 deletions LinqFaster/DefaultIfEmpty.cs
Original file line number Diff line number Diff line change
@@ -0,0 1,29 @@
using System.Runtime.CompilerServices;
// ReSharper disable ForCanBeConvertedToForeach
// ReSharper disable UnusedMember.Global

namespace JM.LinqFaster
{
public static partial class LinqFaster
{
// -------------------------- Arrays --------------------------------------------

/// <summary>
/// Returns an array (For speed) with a single value set to default{T}
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="source"></param>
/// <returns>source or new array{1}</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static T[] DefaultIfEmptyF<T>(this T[] source)
{
if ((source == null)
|| (source.Length == 0)
)
{
return new T[] { default(T) };
}
return source;
}
}
}