开发者

WPF Application slowing down on i5 Processor machine

One of the developed application in WPF is running very slow on i5 process Laptop. UI contains multiple user controls (200+) in nested Items control. Same application is running with good performance in one of the Desktop machine.

Below is the detailed configuration of Laptop where its very slow (50 sec to render the UI) :

Operating System: Windows XP Professional (5.1, Build 2600) Service Pack 3 (2600.xpsp_sp3_gdr.101209-1647) Sys开发者_如何转开发tem Manufacturer: LENOVO System Model: 2537W2K BIOS: Ver 1.00PARTTBLx Processor: Intel(R) Core(TM) i5 CPU M 520 @ 2.40GHz (4 CPUs) Memory: 3060MB RAM Page File: 784MB used, 5172MB available Windows Dir: C:\WINDOWS DirectX Version: DirectX 9.0c (4.09.0000.0904) DX Setup Parameters: Not found DxDiag Version: 5.03.2600.5512 32bit Unicode

Display

Card name: NVIDIA NVS 3100M Manufacturer: NVIDIA Chip type: NVS 3100M DAC type: Integrated RAMDAC Device Key: Enum\PCI\VEN_10DE&DEV_0A6C&SUBSYS_214217AA&REV_A2 Display Memory: 256.0 MB Current Mode: 1680 x 1050 (32 bit) (60Hz) Monitor: ThinkPad Display 1440x900 Monitor Max Res: 1440,900


Below is the detailed configuration of Desktop where its fast (6 sec to render the same UI) :

Operating System: Windows XP Professional (5.1, Build 2600) Service Pack 3 (2600.xpsp_sp3_gdr.101209-1647) System Manufacturer: Dell Inc. System Model: OptiPlex 755

BIOS: Phoenix ROM BIOS PLUS Version 1.10 A04 Processor: Intel(R) Core(TM)2 Duo CPU E6550 @ 2.33GHz (2 CPUs) Memory: 2004MB RAM Page File: 1544MB used, 2353MB available Windows Dir: C:\WINDOWS DirectX Version: DirectX 9.0c (4.09.0000.0904) DX Setup Parameters: Not found DxDiag Version: 5.03.2600.5512 32bit Unicode

Display Card

Card name: Intel(R) Q35 Express Chipset Family Manufacturer: Intel Corporation Chip type: Intel(R) GMA 3100 DAC type: Internal Device Key: Enum\PCI\VEN_8086&DEV_29B2&SUBSYS_02111028&REV_02 Display Memory: 384.0 MB Current Mode: 1280 x 960 (32 bit) (60Hz) Monitor: Plug and Play Monitor Monitor Max Res: 1600,1200 Driver Name: igxprd32.dll Driver Version: 6.14.0010.4837 (English)

Please help me to understand the cause to slow down the rendering.

<Grid x:Name="grid" Margin="3,0,0,15" HorizontalAlignment="Center" VerticalAlignment="Top" 
              IsEnabled="{Binding IsEnableOrDisableControl}">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="70*" />
                <ColumnDefinition Width="05" />
                <ColumnDefinition Width="65" />
                <ColumnDefinition Width="05" />
                <ColumnDefinition Width="65" />
                <ColumnDefinition Width="05" />
                <ColumnDefinition Width="65" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="30" />
                <RowDefinition Height="05" />
                <RowDefinition Height="15" />
                <RowDefinition Height="Auto" />
                <RowDefinition />
            </Grid.RowDefinitions>
            <AppUserControl:NumericUPDown Value="{Binding Total, Mode=TwoWay}"
                                                     MinValue="2" MaxValue="{Binding MaxValue}" Grid.Column="0"  
                                                     Grid.Row="0"
                                                     x:Name="NoOfFltr"
                                                      />
    <Button Background="Transparent" BorderBrush="Transparent" BorderThickness="0"  
                    Grid.Column="2" Grid.Row="0" ToolTip="Plot" HorizontalAlignment="Left"
           >
                <Button.Content>
                    <Image Width="16" Height="16">
                        <Image.Source>
                            <BitmapImage UriSource="..\Pictures\icon.png" DecodePixelWidth="16" />
                        </Image.Source>
                    </Image>
                </Button.Content>                    
            <Button.InputBindings>
            <MouseBinding Gesture="CTRL+LeftClick" Command="{Binding OpenNewWindowCommand}" CommandParameter="0" />
            <MouseBinding Gesture="LeftClick" Command="{Binding OpenCommand}" CommandParameter="1" />
            </Button.InputBindings>
    </Button>
            <TextBlock Text="Text1" Height="20" VerticalAlignment="Top" HorizontalAlignment="Left" Grid.Row="2" Grid.Column="0" />
            <TextBlock Text="Text2" Height="20" VerticalAlignment="Top" HorizontalAlignment="Left" Grid.Row="2" Grid.Column="2" />
            <TextBlock Text="Text3" Height="20" VerticalAlignment="Top" HorizontalAlignment="Left" Grid.Row="2" Grid.Column="4" />
            <TextBlock Text="Text4" Height="20" VerticalAlignment="Top" HorizontalAlignment="Left" Grid.Row="2" Grid.Column="6" />
            <Grid Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="7" HorizontalAlignment="Left" Height="{Binding DataParameterHeight}">
                <ItemsControl Name="BiquadItem" ItemsSource="{Binding Parameters }">
                    <ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <Grid Margin="3">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="70*" />
                                    <ColumnDefinition Width="05" />
                                    <ColumnDefinition Width="65" />
                                    <ColumnDefinition Width="05" />
                                    <ColumnDefinition Width="65" />
                                    <ColumnDefinition Width="05" />
                                    <ColumnDefinition Width="65" />
                                </Grid.ColumnDefinitions>
                        <ComboBox Name="cmbType" Width="70"  HorizontalAlignment="Left" VerticalAlignment="Top" 
                                  ItemsSource="{Binding Source={StaticResource mdwType}}" Grid.Column="0" SelectedValue="{Binding bqType, Mode=TwoWay}" >
                                </ComboBox>
                                <AppUserControl:UnitUpDown  Value="{Binding frq, Mode=TwoWay}" MinValue="0"
                                                     MaxValue="24000" Grid.Column="2" IsEnabled="{Binding Status}" Increment="1" 
                                                      />
                                <AppUserControl:NumericUPDown Value="{Binding scale, Mode=TwoWay}"
                                                     Grid.Column="4" IsEnabled="{Binding Status}" DecimalPoint="2" Increment="0.01" 
                                                     MinValue="{Binding ElementName=biquadGrid, Path=DataContext.MinVal}" 
                                                     MaxValue="{Binding ElementName=bqgrid, Path=DataContext.MaxVal}" />
                                <AppUserControl:NumericUPDown Value="{Binding qFactors, Mode=TwoWay}"
                                                     MinValue="0.001" MaxValue="24" Grid.Column="6" IsEnabled="{Binding qStatus}"  DecimalPoint="3" Increment="0.01" 
                                                      />
                            </Grid>
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                </ItemsControl>                   
            </Grid>
        </Grid>


You can use the WPF Performance Suite from Microsoft (my highlight):

The WPF Performance Suite enables you to analyze the run-time behavior of your WPF applications and determine performance optimizations that you can apply. The WPF Performance Suite includes performance profiling tools called Perforator and Visual Profiler.

Rendering 200+ complex UserControl's within an ItemsControl is a lot - at least for the user to interact with. The graphical muscle of the laptop may be the bottleneck. You could consider using a ListBox to display the UserControl's. ListBox uses a VirtualizingStackPanel to enable UI virtualization.

Also, depending on the DirectX support on Windows XP on your hardware you may experience performance problems. You can even try to turn off hardware acceleration in the display properties of the Windows XP machine to see if that improves WPF performance.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜