File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed
src/benchmarks/micro/libraries/System.Linq Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change
1
+ // Licensed to the .NET Foundation under one or more agreements.
2
+ // The .NET Foundation licenses this file to you under the MIT license.
3
+ // See the LICENSE file in the project root for more information.
4
+
5
+ using BenchmarkDotNet . Attributes ;
6
+ using MicroBenchmarks ;
7
+ using System . Collections . Generic ;
8
+ using System . Collections . Immutable ;
9
+
10
+ namespace System . Linq . Tests
11
+ {
12
+ [ BenchmarkCategory ( Categories . Libraries , Categories . LINQ ) ]
13
+ public class Perf_ImmutableArrayExtensions
14
+ {
15
+ private ImmutableArray < int > _immutableArray ;
16
+
17
+ [ GlobalSetup ]
18
+ public void GlobalSetup ( ) => _immutableArray = ImmutableArray . CreateRange ( Enumerable . Range ( 0 , LinqTestData . Size ) ) ;
19
+
20
+ public IEnumerable < object > Arguments ( )
21
+ {
22
+ yield return LinqTestData . IEnumerable ;
23
+ yield return LinqTestData . ICollection ;
24
+ yield return LinqTestData . IList ;
25
+ yield return LinqTestData . Array ;
26
+ yield return LinqTestData . List ;
27
+ }
28
+
29
+ [ Benchmark ]
30
+ [ ArgumentsSource ( nameof ( Arguments ) ) ]
31
+ [ MemoryRandomization ]
32
+ public bool SequenceEqual ( LinqTestData input ) => ImmutableArrayExtensions . SequenceEqual ( _immutableArray , input . Collection ) ;
33
+
34
+ }
35
+ }
You can’t perform that action at this time.
0 commit comments