Of course, even if I have tried everything to minimize the negative effects on the the performance of the mock data generator, GUI is GUI, it will drag it down anyway, but by how much? I decide to dig a little further.
Thanks to the nature of MVVM, it is easy to swap out the GUI V-VM with ... a CLI! Yes that's the capability MVVM is supposed to have, V-VM are dumb layers and replace them with another UI, business as usual!
I wrapped up Model, Common and BusinessLogic (refer to the source code I published on GitHub, link is at the bottom of part II) into a DLL, and wrote a console program:
using HighThroughputDataGrid.BusinessLogic;
using HighThroughputDataGrid.Common;
using System;
namespace HighOutputDataCli
{
public class DataObserver : IObserver<double>
{
public PerformanceMonitor Performance { get; set; }
public void OnCompleted() { }
public void OnError(Exception error) { }
public void OnNext(double value)
{
if(Performance != null)
{
Performance.Add(value);
Console.WriteLine("Max: {0:0.00}, Min: {1:0.00}, Avg: {2:0.00}", Performance.Maximum, Performance.Minimum, Performance.Average);
}
}
}
public class Program
{
static void Main(string[] args)
{
HighOutputDataSource source = new HighOutputDataSource
{
FreshRateObserver = new Observable<double>(),
NumberOfRandomGenerators = 200
};
DataObserver observer = new DataObserver { Performance = new PerformanceMonitor() };
source.FreshRateObserver.Subscribe(observer);
source.Start();
Console.ReadKey();
}
}
}
That's it, gives us the highest number the mock data generator could do (on my m5 tablet):
Max: 1079.91, Min: 968.99, Avg: 1032.01
Max: 1079.91, Min: 968.99, Avg: 1033.67
Max: 1079.91, Min: 968.99, Avg: 1031.02
Max: 1079.91, Min: 948.77, Avg: 1027.59
Max: 1079.91, Min: 948.77, Avg: 1025.02
Max: 1079.91, Min: 948.77, Avg: 1022.16
Max: 1079.91, Min: 948.77, Avg: 1019.44
Max: 1079.91, Min: 948.77, Avg: 1018.53
Max: 1079.91, Min: 948.77, Avg: 1016.13
Max: 1079.91, Min: 948.77, Avg: 1014.00
Max: 1079.91, Min: 948.77, Avg: 1014.55
It's about 8% - 15% higher than our super efficient WPF DataGrid application could possibly do, that shows the penalty of the modern fancy UI costs.
No comments:
Post a Comment