diff --git a/tests/performance/Perf.BufferList.cs b/tests/performance/Perf.BufferList.cs index b9b202254..ba4c27800 100644 --- a/tests/performance/Perf.BufferList.cs +++ b/tests/performance/Perf.BufferList.cs @@ -1,6 +1,6 @@ namespace Performance; -// INCREMENTAL BUFFER-STYLE INDICATORS +// BUFFER-STYLE INCREMENTING INDICATORS [ShortRunJob] public class BufferLists @@ -8,12 +8,9 @@ public class BufferLists private static readonly IReadOnlyList quotes = Data.GetDefault(); - private static readonly IReadOnlyList reusables - = quotes - .Cast() - .ToList(); + private static readonly QuoteHub provider = new(); - private readonly QuoteHub provider = new(); + private const int n = 14; [GlobalSetup] public void Setup() => provider.Add(quotes); @@ -26,70 +23,22 @@ public void Cleanup() } [Benchmark] - public object EmaIncRusBatch() - { - EmaList sut = new(14) { reusables }; - return sut; - } + public AdxList AdxBuffer() + => new(n) { quotes }; [Benchmark] - public object EmaIncRusItem() - { - EmaList sut = new(14); - - for (int i = 0; i < reusables.Count; i++) - { - sut.Add(reusables[i]); - } - - return sut; - } + public IReadOnlyList AdxSeries() + => quotes.ToAdx(n); [Benchmark] - public object EmaIncRusSplit() - { - EmaList sut = new(14); - - for (int i = 0; i < reusables.Count; i++) - { - sut.Add(reusables[i].Timestamp, reusables[i].Value); - } - - return sut; - } + public EmaList EmaBuffer() + => new(n) { quotes }; [Benchmark] - public object EmaIncQotBatch() - { - EmaList sut = new(14) { quotes }; - return sut; - } - - [Benchmark] - public object EmaIncQot() - { - EmaList sut = new(14); - - for (int i = 0; i < quotes.Count; i++) - { - sut.Add(quotes[i]); - } - - return sut; - } - - // TIME-SERIES EQUIVALENTS - - [Benchmark] - public object EmaSeries() => quotes.ToEma(14); - - [Benchmark] - public object EmaIncrem() - { - EmaList ema = new(14) { quotes }; - return ema; - } + public IReadOnlyList EmaSeries() + => quotes.ToEma(n); [Benchmark] - public object EmaStream() => provider.ToEma(14).Results; + public IReadOnlyList EmaStream() + => provider.ToEma(n).Results; }