Skip to content
Open
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// 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.

using BenchmarkDotNet.Attributes;
using MicroBenchmarks;
using System.Collections.Generic;
using System.Collections.Immutable;

namespace System.Linq.Tests
{
[BenchmarkCategory(Categories.Libraries, Categories.LINQ)]
public class Perf_ImmutableArrayExtensions
{
private ImmutableArray<int> _immutableArray;

[GlobalSetup]
public void GlobalSetup() => _immutableArray = ImmutableArray.CreateRange(Enumerable.Range(0, LinqTestData.Size));

public IEnumerable<object> Arguments()
{
yield return LinqTestData.IEnumerable;
yield return LinqTestData.ICollection;
yield return LinqTestData.IList;
yield return LinqTestData.Array;
yield return LinqTestData.List;
}

[Benchmark]
[ArgumentsSource(nameof(Arguments))]
[MemoryRandomization]
public bool SequenceEqual(LinqTestData input) => _immutableArray.SequenceEqual(input.Collection);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public bool SequenceEqual(LinqTestData input) => _immutableArray.SequenceEqual(input.Collection);
public bool SequenceEqual(LinqTestData input) => ImmutableArrayExtensions.SequenceEqual(_immutableArray, input.Collection);


}
}
Loading