- JM.LinqFaster: 1.1.2
- LinqAF: 3.0.0.0
- StructLinq.BCL: 0.19.1
- NetFabric.Hyperlinq: 3.0.0-beta26
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class RefEnumerationVariableAnalyzerTests : CodeFixVerifier | |
{ | |
protected override DiagnosticAnalyzer GetCSharpDiagnosticAnalyzer() | |
=> new RefEnumerationVariableAnalyzer(); | |
protected override CodeFixProvider GetCSharpCodeFixProvider() | |
=> new RefEnumerationVariableCodeFixProvider(); | |
[Theory] | |
[InlineData("TestData/HLQ004/NoDiagnostic/NoRef.cs")] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using BenchmarkDotNet.Attributes; | |
using BenchmarkDotNet.Jobs; | |
using System.Linq; | |
namespace NetFabric.Hyperlinq.Benchmarks | |
{ | |
[SimpleJob(RuntimeMoniker.Net472, baseline: true)] | |
[SimpleJob(RuntimeMoniker.NetCoreApp50)] | |
[MemoryDiagnoser] | |
public class RangeContainsBenchmarks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using BenchmarkDotNet.Attributes; | |
using System; | |
using System.Linq; | |
namespace ConsoleApp2 | |
{ | |
[MemoryDiagnoser] | |
[DisassemblyDiagnoser(printSource: true)] | |
public class ArrayBenchmarks | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static Expression Using(ParameterExpression variable, Expression content) | |
{ | |
return variable.Type switch | |
{ | |
{IsValueType: true} => ValueTypeUsing(variable, content), | |
_ => ReferenceTypeUsing(variable, content) | |
}; | |
static Expression ValueTypeUsing(Expression variable, Expression content) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace NetFabric.Hyperlinq | |
{ | |
public interface IValueEnumerable<out T, out TEnumerator> | |
: IEnumerable<T> | |
where TEnumerator : struct, IEnumerator<T> | |
{ | |
new TEnumerator GetEnumerator(); | |
} | |
public interface IValueReadOnlyCollection<out T, out TEnumerator> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static int Count<TEnumerable, TEnumerator, TSource>(this TEnumerable source) | |
where TEnumerable : IValueEnumerable<TSource, TEnumerator> | |
where TEnumerator : struct, IEnumerator<TSource> | |
{ | |
using var enumerator = source.GetEnumerator(); | |
var count = 0; | |
while (enumerator.MoveNext()) | |
count++; | |
return count; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Enumerable<T> | |
{ | |
public Enumerable<T> GetEnumerator() | |
=> this; | |
public T Current | |
=> default; | |
public bool MoveNext() | |
=> default; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static int Count<TEnumerable, TEnumerator, TSource>(this TEnumerable source) | |
where TEnumerable : IValueEnumerable<TSource, TEnumerator> | |
where TEnumerator : struct, IEnumerator<TSource> | |
{ | |
var counter = 0; | |
using var enumerator = source.GetEnumerator(); | |
checked | |
{ | |
while (enumerator.MoveNext()) | |
counter++; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static async ValueTask<int> CountAsync<TEnumerable, TEnumerator, TSource>(this TEnumerable source, CancellationToken cancellationToken = default) | |
where TEnumerable : IAsyncValueEnumerable<TSource, TEnumerator> | |
where TEnumerator : struct, IAsyncEnumerator<TSource> | |
{ | |
var counter = 0; | |
var enumerator = source.GetAsyncEnumerator(cancellationToken); | |
try | |
{ | |
checked | |
{ |