|
@@ -18,6 +18,9 @@ namespace Benchmarks.System.Interactive
|
|
|
|
|
|
private int _store;
|
|
|
|
|
|
+ private int[] _array;
|
|
|
+ private List<int> _list;
|
|
|
+
|
|
|
[Benchmark]
|
|
|
public void Ignore()
|
|
|
{
|
|
@@ -25,5 +28,33 @@ namespace Benchmarks.System.Interactive
|
|
|
.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);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|