I have been working on determining why our WPF application runs approximately 3 times slower in our production environment than it does on our local machines. I have been using one of our blades that we use in production to test various changes to settings to try to get the same times. We finally switched the OS from Windows Server 2016 to Windows 10 Pro and the application runs just as fast on the blade as it does on my local machine.
After doing some profiling using dotTrace remotely I was able to determine that the MeasureOverride and ArrangeOverride are taking more time to execute on 2016 than they are on 10. We switched the server to prefer desktop applications over background processes and their was no change in execution time. Also we have not overriden any of the Measure or Arrange methods. We are using infragistics for some of our controls so they more than likely have override these.
Does anyone know of a setting or implementation detail of Windows Server 2016 that could account for such drastic changes in execution time?
Edit: We have also tried installing a graphics card, enabling RemoteFX, optimizing a specific form to have less redraws. Also I just went ahead and profiled a WPF application with almost nothing on it and using dotTrace it takes 8ms to do the measure locally and 750ms to do the measures on our server.
Here is the xaml
<Window x:Class="StockWpfApplication.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:StockWpfApplication"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="525">
<Grid>
<TextBlock Text="Text" Height="20" Width="50" HorizontalAlignment="Left"/>
<Button Content="Button" Height="20" Width="50"/>
</Grid>
As you've discovered there was a difference in the "Power Plans" you were using in Windows 10 Pro, and Windows Server 2016.
After installation of Windows Server, the default Power Plan used might not be optimal depending on what you are getting your Server to do.
RDP'ed desktops running GDI or WPF rendering based apps appear to perform poorly when Balanced Power Plan is in use.
(depending on support....newer or older generations of CPUs might also have different latency issues when switching between the power states when Balanced mode is in operation).