| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 | 
							- // 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 System.Collections.Generic;
 
- using System.Linq;
 
- using System.Threading;
 
- using BenchmarkDotNet.Attributes;
 
- namespace Benchmarks.System.Interactive
 
- {
 
-     [MemoryDiagnoser]
 
-     public class IgnoreElementsBenchmark
 
-     {
 
-         [Params(1, 10, 100, 1000, 10000, 100000, 1000000)]
 
-         public int N;
 
-         private int _store;
 
-         private int[]? _array;
 
-         private List<int>? _list;
 
-         [Benchmark]
 
-         public void Ignore()
 
-         {
 
-             Enumerable.Range(1, N)
 
-                 .IgnoreElements()
 
-                 .Subscribe(v => Volatile.Write(ref _store, v));
 
-         }
 
-         [Benchmark]
 
-         public void IgnoreList()
 
-         {
 
-             _list!
 
-                 .IgnoreElements()
 
-                 .Subscribe(v => Volatile.Write(ref _store, v));
 
-         }
 
-         [Benchmark]
 
-         public void IgnoreArray()
 
-         {
 
-             _array!
 
-                 .IgnoreElements()
 
-                 .Subscribe(v => Volatile.Write(ref _store, v));
 
-         }
 
-         [GlobalSetup]
 
-         public void Setup()
 
-         {
 
-             _array = new int[N];
 
-             _list = new List<int>(N);
 
-             for (var i = 0; i < N; i++)
 
-             {
 
-                 _array[i] = i;
 
-                 _list.Add(i);
 
-             }
 
-         }
 
-     }
 
- }
 
 
  |