Пример #1
0
        void rng_bench <T>(IDataStream <T> stream, [CallerMemberName] string caller = null)
            where T : unmanaged
        {
            var segment = Pow2.T08;
            var total   = Pow2.T17;
            var stats   = StatCollector.Create(0.0);
            var sw      = stopwatch(false);

            for (var i = 0; i < total; i += segment)
            {
                sw.Start();
                var sample = stream.TakeArray(segment);
                sw.Stop();
                for (var j = 0; j < segment; j++)
                {
                    stats.Collect(Numeric.force <T, double>(sample[j]));
                }
            }

            var opname = $"{caller}<{typeof(T).DisplayName()}>";

            Deposit(BenchmarkRecord.Define(total, sw.Elapsed, opname));
        }