You've already forked linux-packaging-mono
Imported Upstream version 5.10.0.69
Former-commit-id: fc39669a0b707dd3c063977486506b6793da2890
This commit is contained in:
parent
d8f8abd549
commit
e2950ec768
@@ -35,10 +35,10 @@ Global
|
||||
{7C70BB15-870B-4946-8098-625DACD645A6}.Debug|Any CPU.Build.0 = netcoreapp-Debug|Any CPU
|
||||
{7C70BB15-870B-4946-8098-625DACD645A6}.Release|Any CPU.ActiveCfg = netcoreapp-Release|Any CPU
|
||||
{7C70BB15-870B-4946-8098-625DACD645A6}.Release|Any CPU.Build.0 = netcoreapp-Release|Any CPU
|
||||
{28FB26C9-E425-4E50-9D1D-08F34560E86E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{28FB26C9-E425-4E50-9D1D-08F34560E86E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{28FB26C9-E425-4E50-9D1D-08F34560E86E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{28FB26C9-E425-4E50-9D1D-08F34560E86E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{28FB26C9-E425-4E50-9D1D-08F34560E86E}.Debug|Any CPU.ActiveCfg = netcoreapp-Debug|Any CPU
|
||||
{28FB26C9-E425-4E50-9D1D-08F34560E86E}.Debug|Any CPU.Build.0 = netcoreapp-Debug|Any CPU
|
||||
{28FB26C9-E425-4E50-9D1D-08F34560E86E}.Release|Any CPU.ActiveCfg = netcoreapp-Release|Any CPU
|
||||
{28FB26C9-E425-4E50-9D1D-08F34560E86E}.Release|Any CPU.Build.0 = netcoreapp-Release|Any CPU
|
||||
{CA488507-3B6E-4494-B7BE-7B4EEEB2C4D1}.Debug|Any CPU.ActiveCfg = netcoreapp-Debug|Any CPU
|
||||
{CA488507-3B6E-4494-B7BE-7B4EEEB2C4D1}.Debug|Any CPU.Build.0 = netcoreapp-Debug|Any CPU
|
||||
{CA488507-3B6E-4494-B7BE-7B4EEEB2C4D1}.Release|Any CPU.ActiveCfg = netcoreapp-Release|Any CPU
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
<AssemblyName>System.Linq</AssemblyName>
|
||||
<RootNamespace>System.Linq</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<!-- Default configurations to help VS understand the configurations -->
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Release|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'uap-Windows_NT-Debug|AnyCPU'" />
|
||||
@@ -91,4 +90,4 @@
|
||||
<Reference Include="System.Runtime.Extensions" />
|
||||
</ItemGroup>
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
|
||||
</Project>
|
||||
</Project>
|
||||
@@ -1,4 +1,4 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace System.Linq
|
||||
/// A buffer into which the contents of an <see cref="IEnumerable{TElement}"/> can be stored.
|
||||
/// </summary>
|
||||
/// <typeparam name="TElement">The type of the buffer's elements.</typeparam>
|
||||
internal struct Buffer<TElement>
|
||||
internal readonly struct Buffer<TElement>
|
||||
{
|
||||
/// <summary>
|
||||
/// The stored items.
|
||||
|
||||
@@ -9,27 +9,34 @@ namespace System.Linq
|
||||
public static partial class Enumerable
|
||||
{
|
||||
public static bool Contains<TSource>(this IEnumerable<TSource> source, TSource value) =>
|
||||
source is ICollection<TSource> collection
|
||||
? collection.Contains(value)
|
||||
: Contains(source, value, null);
|
||||
source is ICollection<TSource> collection ? collection.Contains(value) :
|
||||
Contains(source, value, null);
|
||||
|
||||
public static bool Contains<TSource>(this IEnumerable<TSource> source, TSource value, IEqualityComparer<TSource> comparer)
|
||||
{
|
||||
if (comparer == null)
|
||||
{
|
||||
comparer = EqualityComparer<TSource>.Default;
|
||||
}
|
||||
|
||||
if (source == null)
|
||||
{
|
||||
throw Error.ArgumentNull(nameof(source));
|
||||
}
|
||||
|
||||
foreach (TSource element in source)
|
||||
if (comparer == null)
|
||||
{
|
||||
if (comparer.Equals(element, value))
|
||||
foreach (TSource element in source)
|
||||
{
|
||||
return true;
|
||||
if (EqualityComparer<TSource>.Default.Equals(element, value)) // benefits from devirtualization and likely inlining
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (TSource element in source)
|
||||
{
|
||||
if (comparer.Equals(element, value))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -195,6 +195,42 @@ namespace System.Linq.Tests
|
||||
Perf_LinqTestBase.MeasureMaterializationToDictionary<int>(Perf_LinqTestBase.Wrap(array, wrapType), iteration);
|
||||
}
|
||||
|
||||
[Benchmark]
|
||||
[MemberData(nameof(IterationSizeWrapperData))]
|
||||
public void Contains_ElementNotFound(int size, int iterationCount, Perf_LinqTestBase.WrapperType wrapType)
|
||||
{
|
||||
IEnumerable<int> source = Perf_LinqTestBase.Wrap(Enumerable.Range(0, size).ToArray(), wrapType);
|
||||
|
||||
foreach (BenchmarkIteration iteration in Benchmark.Iterations)
|
||||
{
|
||||
using (iteration.StartMeasurement())
|
||||
{
|
||||
for (int i = 0; i < iterationCount; i++)
|
||||
{
|
||||
source.Contains(size + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Benchmark]
|
||||
[MemberData(nameof(IterationSizeWrapperData))]
|
||||
public void Contains_FirstElementMatches(int size, int iterationCount, Perf_LinqTestBase.WrapperType wrapType)
|
||||
{
|
||||
IEnumerable<int> source = Perf_LinqTestBase.Wrap(Enumerable.Range(0, size).ToArray(), wrapType);
|
||||
|
||||
foreach (BenchmarkIteration iteration in Benchmark.Iterations)
|
||||
{
|
||||
using (iteration.StartMeasurement())
|
||||
{
|
||||
for (int i = 0; i < iterationCount; i++)
|
||||
{
|
||||
source.Contains(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,9 +5,8 @@
|
||||
<IncludePerformanceTests>true</IncludePerformanceTests>
|
||||
<ProjectGuid>{28FB26C9-E425-4E50-9D1D-08F34560E86E}</ProjectGuid>
|
||||
</PropertyGroup>
|
||||
<!-- Default configurations to help VS understand the configurations -->
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Release|AnyCPU'" />
|
||||
<ItemGroup>
|
||||
<Compile Include="Perf.Linq.cs" />
|
||||
<Compile Include="Perf.LinqTestBase.cs" />
|
||||
|
||||
@@ -94,11 +94,11 @@ namespace System.Linq.Tests
|
||||
int[] source = { 8, 3, 12, 4, 6, 10 };
|
||||
int[] expected = { 3, 12, 4, 6, 10 };
|
||||
|
||||
Assert.Equal(expected, source.SkipWhile((e, i) => e % 2 == 0));
|
||||
Assert.Equal(expected, source.SkipWhile(e => e % 2 == 0));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void PredicateManyFalseOnSecondInex()
|
||||
public void PredicateManyFalseOnSecondIndex()
|
||||
{
|
||||
int[] source = { 8, 3, 12, 4, 6, 10 };
|
||||
int[] expected = { 3, 12, 4, 6, 10 };
|
||||
@@ -112,7 +112,7 @@ namespace System.Linq.Tests
|
||||
int[] source = { 3, 2, 4, 12, 6 };
|
||||
int[] expected = { 3, 2, 4, 12, 6 };
|
||||
|
||||
Assert.Equal(expected, source.SkipWhile((e, i) => e % 2 == 0));
|
||||
Assert.Equal(expected, source.SkipWhile(e => e % 2 == 0));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
<PropertyGroup>
|
||||
<ProjectGuid>{7C70BB15-870B-4946-8098-625DACD645A6}</ProjectGuid>
|
||||
</PropertyGroup>
|
||||
<!-- Default configurations to help VS understand the configurations -->
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Release|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Debug|AnyCPU'" />
|
||||
@@ -81,7 +80,6 @@
|
||||
<Link>Common\System\Linq\SkipTakeData.cs</Link>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<!-- DebuggerAttribute tests require internal framework Reflection and will not work on AoT platforms.
|
||||
The proper way to test these is via the debugger expression evaluator, not Reflection. -->
|
||||
<ItemGroup Condition="'$(TargetGroup)'!='uapaot'">
|
||||
@@ -92,9 +90,8 @@
|
||||
<Compile Include="ToLookupTests.DebuggerAttributes.cs" />
|
||||
<Compile Include="EnumerableDebugViewTests.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Resources\$(AssemblyName).rd.xml" />
|
||||
</ItemGroup>
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
|
||||
</Project>
|
||||
</Project>
|
||||
Reference in New Issue
Block a user