示例#1
0
        private static ValueTuple <int, int> RunBenchmark(int sourceLength, int subCollectionLength)
        {
            const int N = 100000;

            var source        = Enumerable.Range(1, sourceLength).ToArray();
            var subCollection = Enumerable.Range(1, subCollectionLength).ToArray(); // This gets repeated `sourceLength` times.

            var iterator = source.SelectMany(_ => subCollection);

            return(Benchmarker.Bench(state =>
            {
                for (int i = 0; i < N; i++)
                {
                    state.ToArray();
                }
            }, iterator));
        }