locked
Surprising performance comparison: Windows Store apps(C#) vs WPF

    Question

  • Tody, due to a curiosity of the performance of Windows Store apps(C#) compared to WPF, I wrote a mini project for both version. Bassically, the project does nothing except to populate the items of a ListView with 500 objects. The comparison result was really a big shock: Windows Store apps version was almost 10x slower than WPF version, and memory consumption is 1200mb : 190mb! Thats unbelievable. Below is the code snippet:

    The ItemTemplate and view model are the same:

    <DataTemplate x:Key="myLvwItemTemplate">
                        <StackPanel Orientation="Horizontal">
                            <Button Content="{Binding Id}" />
                            <Button Content="{Binding Name}" />
                            <Button Content="{Binding Id}" />
                            <Button Content="{Binding Name}" />
                            <Button Content="{Binding Id}" />
                            <Button Content="{Binding Name}" />
                            <Button Content="{Binding Id}" />
                            <Button Content="{Binding Name}" />
                            <Button Content="{Binding Id}" />
                            <Button Content="{Binding Name}" />
                            <Button Content="{Binding Id}" />
                            <Button Content="{Binding Name}" />
                            <Button Content="{Binding Id}" />
                            <Button Content="{Binding Name}" />
                            <Button Content="{Binding Id}" />
                            <Button Content="{Binding Name}" />
                            <Button Content="{Binding Id}" />
                            <Button Content="{Binding Name}" />
                            <Button Content="{Binding Id}" />
                            <Button Content="{Binding Name}" />
                            <Button Content="{Binding Id}" />
                            <Button Content="{Binding Name}" />
                            <Button Content="{Binding Id}" />
                            <Button Content="{Binding Name}" />
                            <Button Content="{Binding Id}" />
                            <Button Content="{Binding Name}" />
                            <Button Content="{Binding Id}" />
                            <Button Content="{Binding Name}" />
                            <Button Content="{Binding Id}" />
                            <Button Content="{Binding Name}" />
                            <Button Content="{Binding Id}" />
                            <Button Content="{Binding Name}" />
                            <Button Content="{Binding Id}" />
                            <Button Content="{Binding Name}" />
                            <Button Content="{Binding Id}" />
                            <Button Content="{Binding Name}" />
                            <Button Content="{Binding Id}" />
                            <Button Content="{Binding Name}" />
                            <Button Content="{Binding Id}" />
                            <Button Content="{Binding Name}" />
                            <Button Content="{Binding Id}" />
                            <Button Content="{Binding Name}" />
                            <Button Content="{Binding Id}" />
                            <Button Content="{Binding Name}" />
                            <Button Content="{Binding Id}" />
                            <Button Content="{Binding Name}" />
                            <Button Content="{Binding Id}" />
                            <Button Content="{Binding Name}" />
                        </StackPanel>
                    </DataTemplate>

    view model:

        public class TestItem
        {
            public int Id { get; set; }
            public string Name { get; set; }
        }
    

    Windows store apps version:

    MainPage.xaml:

    <Page x:Class="HelloWorld.MainPage"
          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          x:Name="rootPage">
    
        <Grid Background="Blcak"
              DataContext="{Binding ElementName=rootPage}">
    
            <ListView ItemsSource="{Binding TestItems}" ItemTemplate="{StaticResource myLvwItemTemplate}">
                <ListView.ItemsPanel>
                    <ItemsPanelTemplate>
                        <StackPanel />
                    </ItemsPanelTemplate>
                </ListView.ItemsPanel>
    
            </ListView>
    
        </Grid>
    </Page>
    

    MainPage.xaml.cs:

        public sealed partial class MainPage : Page
        {
            public ObservableCollection<TestItem> TestItems { get; set; }
            public MainPage()
            {
                TestItems = new ObservableCollection<TestItem>();
                for (int i = 0; i < 500; i++)
                {
                    TestItems.Add(new TestItem() { Id = i + 1, Name = "Simon" });
                }
    
                this.InitializeComponent();
            }
        }

    WPF version:

    MainWindow.xaml:

    <Window x:Class="WpfHelloWorld.MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            Title="MainWindow"
            x:Name="root"
            Height="950"
            Width="720">
        <Grid VerticalAlignment="Stretch"
              DataContext="{Binding ElementName=root}">
    
            <ListView ItemsSource="{Binding TestItems}"
                      ItemTemplate="{StaticResource myLvwItemTemplate}">
                <ListView.ItemsPanel>
                    <ItemsPanelTemplate>
                        <StackPanel />
                    </ItemsPanelTemplate>
                </ListView.ItemsPanel>
    
            </ListView>
        </Grid>
    </Window>
    
    MainWindow.xaml.cs:
        public partial class MainWindow : Window
        {
            public ObservableCollection<TestItem> TestItems { get; set; }
            public MainWindow()
            {
                TestItems = new ObservableCollection<TestItem>();
                for (int i = 0; i < 500; i++)
                {
                    TestItems.Add(new TestItem() { Id = i+1, Name = "Simon" });
                }
    
                InitializeComponent();
            }
    
     
    
      
        }

    Is there something wrong with my code? Why the WinRT version ListView rendering is so inefficient?

    Sunday, February 01, 2015 10:36 AM

All replies

  • Thanks for the report. This explains a few things I've been wondering.
    Sunday, February 01, 2015 4:45 PM
  • This results are really shocking and frustrating! I expected c# apps on WinRT could do better with regard to performance than its WPF version. Can anyone shed more light on that?
    Monday, February 02, 2015 10:06 AM
  • Thanks for sharing this Silverbird! Find this very interesting. Unfortunatelly I won't have time doing any tests myself right now but could you maybe try this and see if you get similar results:

    - Instead of a ListView, change it to an ItemsControl. Just to check if there's something with the ListView.

    - In all your bindings in the datatemplate could you add in the end like {Binding Name,Mode=OneTime}. It'll probably load faster but check if you get the same difference. 

    - In the WPF version, you force the width and height, could that in some way make this big difference? Maybe some resolution difference performance thingy...Dunno maybe.

    - Stupid question, I assume you're running both versions on the same machine right?!

    - One other thing. Usually when I do those kind of performance tests I need to run the apps in Release mode. I change the combobox from Debug to Release. I always notice a big difference in performance between these two modes. Guess it has something to do with the bindings I think. btw. Use the Stopwatch class to be sure of the timings and a message box to present the result. Maybe present the result in the loaded event.








    Monday, February 02, 2015 10:23 AM
  • Hi, Luc, thanks! I am running the test on the same machine(Win 8.1 x64) in debug mode. According to your tips, I've rewritten the two mini test project and made some changes:

    1.Changed ListView control to ItemsControl in Windows Store apps;

    2.Changed the binding mode to OneTime;

    3.Removed the width and height of WPF main window;

    4.Changed the solution building mode to 'release' from 'debug', and 'x64' platforms;

    5.In order to prevent memory leak, TestItem, MainPage & MainWindow implement INotifyPropertyChanged.

     Since I don't know which event would fired when the ItemsControl/ListView has finished items populating, so I can't give you the tickcount elapsed. But I can say the result is almost just the same as before: Based on my experience, Windows Store version is still much slower than WPF version, about 7x~10x slower. And the memory consumption is 1150MB:180MB.

    What's wrong with this performance comparison? 

    Here are the code snippets:

    View Mode:

        public class TestItem : INotifyPropertyChanged
        {
            public int Id { get; set; }
            public string Name { get; set; }
    
            public event PropertyChangedEventHandler PropertyChanged;
        }

    ItemTemplate:

            <DataTemplate x:Key="myLvwItemTemplate">
                <StackPanel Orientation="Horizontal">
                    <Button Content="{Binding Id,Mode=OneTime}" />
                    <Button Content="{Binding Name,Mode=OneTime}" />
                    <Button Content="{Binding Id,Mode=OneTime}" />
                    <Button Content="{Binding Name,Mode=OneTime}" />
                    <Button Content="{Binding Id,Mode=OneTime}" />
                    <Button Content="{Binding Name,Mode=OneTime}" />
                    <Button Content="{Binding Id,Mode=OneTime}" />
                    <Button Content="{Binding Name,Mode=OneTime}" />
                    <Button Content="{Binding Id,Mode=OneTime}" />
                    <Button Content="{Binding Name,Mode=OneTime}" />
                    <Button Content="{Binding Id,Mode=OneTime}" />
                    <Button Content="{Binding Name,Mode=OneTime}" />
                    <Button Content="{Binding Id,Mode=OneTime}" />
                    <Button Content="{Binding Name,Mode=OneTime}" />
                    <Button Content="{Binding Id,Mode=OneTime}" />
                    <Button Content="{Binding Name,Mode=OneTime}" />
                    <Button Content="{Binding Id,Mode=OneTime}" />
                    <Button Content="{Binding Name,Mode=OneTime}" />
                    <Button Content="{Binding Id,Mode=OneTime}" />
                    <Button Content="{Binding Name,Mode=OneTime}" />
                    <Button Content="{Binding Id,Mode=OneTime}" />
                    <Button Content="{Binding Name,Mode=OneTime}" />
                    <Button Content="{Binding Id,Mode=OneTime}" />
                    <Button Content="{Binding Name,Mode=OneTime}" />
                    <Button Content="{Binding Id,Mode=OneTime}" />
                    <Button Content="{Binding Name,Mode=OneTime}" />
                    <Button Content="{Binding Id,Mode=OneTime}" />
                    <Button Content="{Binding Name,Mode=OneTime}" />
                    <Button Content="{Binding Id,Mode=OneTime}" />
                    <Button Content="{Binding Name,Mode=OneTime}" />
                    <Button Content="{Binding Id,Mode=OneTime}" />
                    <Button Content="{Binding Name,Mode=OneTime}" />
                    <Button Content="{Binding Id,Mode=OneTime}" />
                    <Button Content="{Binding Name,Mode=OneTime}" />
                    <Button Content="{Binding Id,Mode=OneTime}" />
                    <Button Content="{Binding Name,Mode=OneTime}" />
                    <Button Content="{Binding Id,Mode=OneTime}" />
                    <Button Content="{Binding Name,Mode=OneTime}" />
                    <Button Content="{Binding Id,Mode=OneTime}" />
                    <Button Content="{Binding Name,Mode=OneTime}" />
                    <Button Content="{Binding Id,Mode=OneTime}" />
                    <Button Content="{Binding Name,Mode=OneTime}" />
                    <Button Content="{Binding Id,Mode=OneTime}" />
                    <Button Content="{Binding Name,Mode=OneTime}" />
                    <Button Content="{Binding Id,Mode=OneTime}" />
                    <Button Content="{Binding Name,Mode=OneTime}" />
                    <Button Content="{Binding Id,Mode=OneTime}" />
                    <Button Content="{Binding Name,Mode=OneTime}" />
                </StackPanel>
            </DataTemplate>

    MainPage.xaml

    <Page x:Class="App1.MainPage"
          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          x:Name="rootPage">
    
        <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
              DataContext="{Binding ElementName=rootPage}">
            <ItemsControl ItemsSource="{Binding TestItems}"
                          ItemTemplate="{StaticResource myLvwItemTemplate}">
                <ItemsControl.ItemsPanel>
                    <ItemsPanelTemplate>
                        <StackPanel />
                    </ItemsPanelTemplate>
                </ItemsControl.ItemsPanel>
    
            </ItemsControl>
    
        </Grid>
    </Page>
    

    MainPage.xaml.cs

        public sealed partial class MainPage : Page, INotifyPropertyChanged
        {
            public ObservableCollection<TestItem> TestItems { get; private set; }
    
            public MainPage()
            {
                TestItems = new ObservableCollection<TestItem>();
                for (int i = 0; i < 500; i++)
                {
                    TestItems.Add(new TestItem() { Id = i + 1, Name = "Simon" });
                }
    
                this.InitializeComponent();
            }
    
            public event PropertyChangedEventHandler PropertyChanged;
        }

    MainWindow.xaml:

    <Window x:Class="WpfHelloWorld.MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            Title="MainWindow"
            x:Name="root">
    
        <Grid VerticalAlignment="Stretch"
              DataContext="{Binding ElementName=root}">
    
            <ListView ItemsSource="{Binding TestItems}"
                      ItemTemplate="{StaticResource myLvwItemTemplate}">
                <ListView.ItemsPanel>
                    <ItemsPanelTemplate>
                        <StackPanel />
                    </ItemsPanelTemplate>
                </ListView.ItemsPanel>
    
            </ListView>
         
        </Grid>
    </Window>
    

    MainWindow.xaml.cs:

        public partial class MainWindow : Window, INotifyPropertyChanged
        {
            public ObservableCollection<TestItem> TestItems{ get; private set; }
     
            public MainWindow()
            {
                TestItems = new ObservableCollection<TestItem>();
                for (int i = 0; i < 500; i++)
                {
                    TestItems.Add(new TestItem() { Id = i+1, Name = "Simon" });
                }
    
                InitializeComponent();
            }
    
            public event PropertyChangedEventHandler PropertyChanged;
        }

    Monday, February 02, 2015 11:25 AM
  • can you attach the projects so others can quickly test out the speculations.

    Should you turn on virutalmode for list view?

    Monday, February 02, 2015 2:57 PM
  • I don't believe in the result

    so here is what I did

    WinRT

    <Page
        x:Class="App1.MainPage"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="using:App1"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d" x:Name="rootPage">
        <Page.Resources>
            <DataTemplate x:Key="myLvwItemTemplate">
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="{Binding Id}" />
                    <TextBlock Text="{Binding Name}" />
                    <TextBlock Text="{Binding Id}" />
                    <TextBlock Text="{Binding Name}" />
                    <TextBlock Text="{Binding Id}" />
                    <TextBlock Text="{Binding Name}" />
                    <TextBlock Text="{Binding Id}" />
                    <TextBlock Text="{Binding Name}" />
                    <TextBlock Text="{Binding Id}" />
                    <TextBlock Text="{Binding Name}" />
                    <TextBlock Text="{Binding Id}" />
                    <TextBlock Text="{Binding Name}" />
                    <TextBlock Text="{Binding Id}" />
                    <TextBlock Text="{Binding Name}" />
                    <TextBlock Text="{Binding Id}" />
                    <TextBlock Text="{Binding Name}" />
                    <TextBlock Text="{Binding Id}" />
                    <TextBlock Text="{Binding Name}" />
                    <TextBlock Text="{Binding Id}" />
                    <TextBlock Text="{Binding Name}" />
                    <TextBlock Text="{Binding Id}" />
                    <TextBlock Text="{Binding Name}" />
                    <TextBlock Text="{Binding Id}" />
                    <TextBlock Text="{Binding Name}" />
                    <TextBlock Text="{Binding Id}" />
                    <TextBlock Text="{Binding Name}" />
                    <TextBlock Text="{Binding Id}" />
                    <TextBlock Text="{Binding Name}" />
                    <TextBlock Text="{Binding Id}" />
                    <TextBlock Text="{Binding Name}" />
                    <TextBlock Text="{Binding Id}" />
                    <TextBlock Text="{Binding Name}" />
                    <TextBlock Text="{Binding Id}" />
                    <TextBlock Text="{Binding Name}" />
                    <TextBlock Text="{Binding Id}" />
                    <TextBlock Text="{Binding Name}" />
                    <TextBlock Text="{Binding Id}" />
                    <TextBlock Text="{Binding Name}" />
                    <TextBlock Text="{Binding Id}" />
                    <TextBlock Text="{Binding Name}" />
                    <TextBlock Text="{Binding Id}" />
                    <TextBlock Text="{Binding Name}" />
                    <TextBlock Text="{Binding Id}" />
                    <TextBlock Text="{Binding Name}" />
                    <TextBlock Text="{Binding Id}" />
                    <TextBlock Text="{Binding Name}" />
                    <TextBlock Text="{Binding Id}" />
                    <TextBlock Text="{Binding Name}" />
                </StackPanel>
            </DataTemplate>
        </Page.Resources>
    
        <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
              DataContext="{Binding ElementName=rootPage}">
            <ItemsControl x:Name="_listView" ItemsSource="{Binding TestItems}"
                          ItemTemplate="{StaticResource myLvwItemTemplate}" VirtualizingStackPanel.VirtualizationMode="Recycling">
                <ItemsControl.ItemsPanel>
                    <ItemsPanelTemplate>
                        <StackPanel />
                    </ItemsPanelTemplate>
                </ItemsControl.ItemsPanel>
    
            </ItemsControl>
    
        </Grid>
    
    </Page>


    Code behind

    public class TestItem : INotifyPropertyChanged
        {
            public int Id { get; set; }
            public string Name { get; set; }
    
            public event PropertyChangedEventHandler PropertyChanged;
        }
    
        public sealed partial class MainPage : Page
        {
            public ObservableCollection<TestItem> TestItems { get; private set; }
    
    
            public MainPage()
            {
                this.InitializeComponent();
                
            }
    
            public event PropertyChangedEventHandler PropertyChanged;
    
            protected override void OnNavigatedTo(NavigationEventArgs e)
            {
                base.OnNavigatedTo(e);
                this.DoubleTapped+=OnDoubleTapped;
            }
    
            private void OnDoubleTapped(object sender, DoubleTappedRoutedEventArgs e)
            {
                DateTime dt = DateTime.Now;
    
    
                int count = 100;
                TestItem[] items = new TestItem[count];
                for (int i = 0; i < count; i++)
                {
                    items[i] = (new TestItem() { Id = i + 1, Name = "Simon" });
                }
    
                _listView.ItemsSource = items;
    
                var span = DateTime.Now - dt;
                Debug.WriteLine(span.ToString());
            }
    
            
    
            
    
        }


    WPF version

    <Window x:Class="WpfApplication1.MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            Title="MainWindow" WindowState="Maximized" x:Name="root">
        <Window.Resources>
            <DataTemplate x:Key="myLvwItemTemplate">
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="{Binding Id}" />
                    <TextBlock Text="{Binding Name}" />
                    <TextBlock Text="{Binding Id}" />
                    <TextBlock Text="{Binding Name}" />
                    <TextBlock Text="{Binding Id}" />
                    <TextBlock Text="{Binding Name}" />
                    <TextBlock Text="{Binding Id}" />
                    <TextBlock Text="{Binding Name}" />
                    <TextBlock Text="{Binding Id}" />
                    <TextBlock Text="{Binding Name}" />
                    <TextBlock Text="{Binding Id}" />
                    <TextBlock Text="{Binding Name}" />
                    <TextBlock Text="{Binding Id}" />
                    <TextBlock Text="{Binding Name}" />
                    <TextBlock Text="{Binding Id}" />
                    <TextBlock Text="{Binding Name}" />
                    <TextBlock Text="{Binding Id}" />
                    <TextBlock Text="{Binding Name}" />
                    <TextBlock Text="{Binding Id}" />
                    <TextBlock Text="{Binding Name}" />
                    <TextBlock Text="{Binding Id}" />
                    <TextBlock Text="{Binding Name}" />
                    <TextBlock Text="{Binding Id}" />
                    <TextBlock Text="{Binding Name}" />
                    <TextBlock Text="{Binding Id}" />
                    <TextBlock Text="{Binding Name}" />
                    <TextBlock Text="{Binding Id}" />
                    <TextBlock Text="{Binding Name}" />
                    <TextBlock Text="{Binding Id}" />
                    <TextBlock Text="{Binding Name}" />
                    <TextBlock Text="{Binding Id}" />
                    <TextBlock Text="{Binding Name}" />
                    <TextBlock Text="{Binding Id}" />
                    <TextBlock Text="{Binding Name}" />
                    <TextBlock Text="{Binding Id}" />
                    <TextBlock Text="{Binding Name}" />
                    <TextBlock Text="{Binding Id}" />
                    <TextBlock Text="{Binding Name}" />
                    <TextBlock Text="{Binding Id}" />
                    <TextBlock Text="{Binding Name}" />
                    <TextBlock Text="{Binding Id}" />
                    <TextBlock Text="{Binding Name}" />
                    <TextBlock Text="{Binding Id}" />
                    <TextBlock Text="{Binding Name}" />
                    <TextBlock Text="{Binding Id}" />
                    <TextBlock Text="{Binding Name}" />
                    <TextBlock Text="{Binding Id}" />
                    <TextBlock Text="{Binding Name}" />
                </StackPanel>
            </DataTemplate>
        </Window.Resources>
        <Grid VerticalAlignment="Stretch"
              DataContext="{Binding ElementName=root}">
    
            <ListView x:Name="_listView" ItemsSource="{Binding TestItems}"
                      ItemTemplate="{StaticResource myLvwItemTemplate}" VirtualizingPanel.VirtualizationMode="Recycling">
                <ListView.ItemsPanel>
                    <ItemsPanelTemplate>
                        <StackPanel />
                    </ItemsPanelTemplate>
                </ListView.ItemsPanel>
    
            </ListView>
    
        </Grid>
    
    </Window>


    Code behind

    using System;
    using System.Collections.Generic;
    using System.Collections.ObjectModel;
    using System.ComponentModel;
    using System.Diagnostics;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Data;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Imaging;
    using System.Windows.Navigation;
    using System.Windows.Shapes;
    
    namespace WpfApplication1
    {
        public class TestItem : DependencyObject
        {
            public int Id
            {
                get { return (int)GetValue(IdProperty); }
                set { SetValue(IdProperty, value); }
            }
    
            public string Name
            {
                get { return (string)GetValue(NameProperty); }
                set { SetValue(NameProperty, value); }
            }
    
            
            public static readonly DependencyProperty NameProperty =
                DependencyProperty.Register("Name", typeof(string), typeof(TestItem), new PropertyMetadata(string.Empty));
    
            
            
            public static readonly DependencyProperty IdProperty =
                DependencyProperty.Register("Id", typeof(int), typeof(TestItem), new PropertyMetadata(0));
    
            
        }
    
        public partial class MainWindow : Window
        {
            public MainWindow()
            {
                InitializeComponent();
                
            }
    
            protected override void OnMouseDoubleClick(MouseButtonEventArgs e)
            {
                base.OnMouseDoubleClick(e);
                DateTime dt = DateTime.Now;
                int count = 100;
                TestItem[] items = new TestItem[count];
                for (int i = 0; i < count; i++)
                {
                    items[i] = (new TestItem() { Id = i + 1, Name = "Simon" });
                }
    
                _listView.ItemsSource = items;
                var span = DateTime.Now - dt;
                Debug.WriteLine(span.ToString());
            }
    
          
        }
    }

    For the double tap/double click event handler  the timer in debug versions are:

    WINRT:00:00:00.0020001 WPF:00:00:00.0059933

    Previous the template using button control is very different on two platforms. so I use a more or less simpler text block.

    the WinRT is much faster in rendering (more contents on WINRT version as well).

    As in memory, this is very sensitive, as you need to know what u r looking into

    Under release mode:

    WinRT commited 220MB

    WPF commited 235MB

    Although WinRT uses more private data at 53MB comparing to WPF 20MB committed.

    But this is very high level view, because two runtime differ a lot.

    There is no much point to compare memory if you don't know exactly what these memory are.


    • Edited by hereafter Monday, February 02, 2015 3:51 PM
    Monday, February 02, 2015 3:41 PM
  • Hi, hereafter, sorry I have no time to test your code now, but I'd like to point out that the definitions of TestItem have some difference -- Dependency object is much heavier!

    Btw: it would be much better to use a message dialog or box to inform when the listview is completely populated.

    Monday, February 02, 2015 4:57 PM
  • That is subtle.

    Do not think it will make 10x slower.

    The issue is in button control

    Monday, February 02, 2015 11:47 PM
  • That is subtle.

    Do not think it will make 10x slower.

    The issue is in button control

    What does 'subtle' mean? I am not 'thinking' it will make 10x slower, it's my demo app that told me it's about 10x slower. btw: Have you test my code? How slower is the app demo than the WPF demo?

    I've tested your code and made some small changes:

    1.Changed the base class of TestItem in WPF project to Object from DependencyObject;

    2.Changed the loop count to 999 from 100, in order to make the performance difference more obvious;

    3.I removed the time counting part of your code. However I cannot find a working method to count the time, so I just use the watch on my phone to count the seconds.

    Then I run the two demo in Win8.1(x64) release mode, and the result is:

    1.Memory consumption: 685MB : 170MB(Sourse: Windows Task Manager);

    2.Time eclapsed: 7.0s: 4.5s(Source: my phone watch. I‘ve tried StopWatch, but the result seems quite weird. )

    The time eclapse part of the test result is slight different compared to my original test. I think it's due to the Button control is replaced by TextBlock, which is much lighter than Button. But we all know the using of Button control is very common in actual  projects. In short, your code can't prove that it is not the truth that metro apps can be much slower than its WPF version in common use. I do like WinRT os(in fact I've a surface 2 and use it frequently), but I do hope it can do better, or at least not worse than WPF, with regard to performance!

    btw: My account is still not verfied, so can't post the link of my project source code.







    Tuesday, February 03, 2015 3:52 AM