In terms of performance, MVVM behaves very well in several scenarios in terms of data retrieval (latency driven) and data input (throughput and scalability driven). The ability to have an impressive view abstraction in a virtual machine without having to rely on MVC (action) pipelines makes programming very enjoyable and gives the developer the choice to use different designs and optimization techniques. Data binding itself is done by implementing special .NET interfaces that can be easily centralized.
Speaking of latency, it differs slightly from the previous examples based on the web request-response time, which is not available in MVVM. Theoretically speaking, there is no latency at all in the MVVM design pattern.
In a particular implementation within XAML-based languages, latency can refer to two different types of time. During data binding, latency is the time between when the virtual machine makes the new data available and the view actually renders it. Instead, when executing a command, latency is the time between the moment the command is invoked and the completion of all the relevant handlers. We usually use the former definition until we specify otherwise.
Although the nominal latency is almost zero (a few milliseconds due to the dictionary-based data binding configuration), specific implementation issues regarding latency do exist. In either model or view model, notification of updated data is created by triggering the view using the INotifyPropertyChanged interface.
The .NET interface causes the view to read the underlying data again. Since all notifications are created by a single .NET event, this can easily become a bottleneck due to the serialized approach used by any delegates or event handlers in the .NET world.
On the contrary, when working with data coming from a view to a model, such binding is usually configured declaratively in the {Binding …} keyword, which supports defining binding directions and trigger times (to select from an out-of-focus event CLR control or when a property value changes).
XAML data binding does not add measured time during its execution. Although it does, as mentioned, such binding can tie together multiple properties or dependency properties of a control. Binding this interaction logic can significantly increase latency time by adding some nasty view-level latency. One fact is that any validation logic adds additional latency. It’s even worse if such validation is not formal, such as checking a certain ID or CODE against a database value.
When it comes to scalability, MVVM patterns do some work, whereas we can do a specific analysis of the XAML implementation. It’s easy to say that scaling is not possible because MVVM is a tiered desktop class architecture that cannot scale. Instead, we can say that in a multi-tenant scenario with multiple client systems connected to a 2- or 3-tier system architecture, simple MVVM and XAML-based frameworks will never be a bottleneck. Being able to use the full .NET stack in WPF gives us the ability to use all available synchronization methods to leverage a directly connected DBMS or middleware tier.
Instead of scaling up by moving the application to a system of increased CPU clock speeds, an XAML-based application will benefit more from a system of increased CPU cores. Obviously, to capitalize on multiple CPU cores, mastering parallel techniques is a must.
In terms of resource utilization, MVVM-based architectures only require a simple POCO class as Model and ViewModel. The only additional requirement is the implementation of the INotifyPropertyChanged interface, which costs almost nothing. Speaking of the template, unlike MVC, which has a specific development workflow, MVVM does not offer such a feature. Multiple commands with multiple logics can process their respective logic (along with an asynchronous call) with local virtual machine data or by going to the persistence layer to get the missing information. We have all the options.
While MVVM costs nothing in terms of graphical rendering, XAML-based frameworks massively leverage hardware-accelerated user controls. Speaking of extreme choices, Windows Forms-based visualization with a Graphics Device Interface (GDI) requires much less resources and can deliver higher frame rates on highly refreshed data. Thus, if a very high FPS is required, the choice is still available to visualize the WPF area in GDI. For other XAML languages, the choice is not so easy. Obviously, this does not mean that XAML is slow to render with a DirectX-based engine. Just keep in mind that WPF animation requires a good graphics processing unit (GPU), while basic GDI animation will run on any system, even though it is outdated.
Speaking of accessibility, MVVM-based architectures usually lead programmers to good programming. Because MVC allows for this, MVVM designs can be tested because of their high modularity. While a controller uses a pipeline workflow to process any requests, a ViewModel is more flexible and can be tested with multiple initialization conditions. This makes it more powerful, but also less predictable than the Controller, and thus more difficult to use. From a design perspective, the Controller acts like a transaction script, while the ViewModel acts in a more realistic, object-oriented approach.