Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. WPF Performance

WPF Performance

Scheduled Pinned Locked Moved The Lounge
csharpcsswpfwinformsdesign
64 Posts 27 Posters 3 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R realJSOP

    The chart re-renders when the user selects/deselects a series, chooses a different chart, or chooses a different time period to show the data for (none of the rest of the app is affected). Even if you're taking about a handful of data points, the delay is obvious.

    ".45 ACP - because shooting twice is just silly" - JSOP, 2010
    -----
    You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
    -----
    "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997

    D Offline
    D Offline
    Dan Neely
    wrote on last edited by
    #38

    For the series change case, could you just put all N series on the chart initially and just cycle the color between transparent and not? With most of the overhead apparently being in creating smart points you might be able to get a good speedup in that case.

    Did you ever see history portrayed as an old man with a wise brow and pulseless heart, waging all things in the balance of reason? Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful? --Zachris Topelius

    R 1 Reply Last reply
    0
    • D Dan Neely

      For the series change case, could you just put all N series on the chart initially and just cycle the color between transparent and not? With most of the overhead apparently being in creating smart points you might be able to get a good speedup in that case.

      Did you ever see history portrayed as an old man with a wise brow and pulseless heart, waging all things in the balance of reason? Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful? --Zachris Topelius

      R Offline
      R Offline
      realJSOP
      wrote on last edited by
      #39

      No, because as long as there's a series, there's a legend item as well, not to mention the recalculation of the max Y-axis value and the appropriate interval. I'm essentially coloring outside the lines of the "typical" usage.

      ".45 ACP - because shooting twice is just silly" - JSOP, 2010
      -----
      You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
      -----
      "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997

      D I 2 Replies Last reply
      0
      • R realJSOP

        No, because as long as there's a series, there's a legend item as well, not to mention the recalculation of the max Y-axis value and the appropriate interval. I'm essentially coloring outside the lines of the "typical" usage.

        ".45 ACP - because shooting twice is just silly" - JSOP, 2010
        -----
        You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
        -----
        "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997

        D Offline
        D Offline
        Dan Neely
        wrote on last edited by
        #40

        Doesn't the chart allow you to disable/hide legends for individual series?

        Did you ever see history portrayed as an old man with a wise brow and pulseless heart, waging all things in the balance of reason? Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful? --Zachris Topelius

        1 Reply Last reply
        0
        • R realJSOP

          That's got some pretty funny comments, the most humorous of which is the casual use of the word "trivial" when talking about WPF. Yeah - it's trivial if you don't need to color outside the lines. Reputationator has some requirements that prevent the use of Xaml in some instances. In both the winforms app and the WPF app, I build the chart objects in the CS files, mostly because it's easier to do it that way, but there are other reasons. BTW, I have a DX10-compatible video card (nVidia 8800GTX), so I don't think that's the problem.

          ".45 ACP - because shooting twice is just silly" - JSOP, 2010
          -----
          You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
          -----
          "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997

          _ Offline
          _ Offline
          _beauw_
          wrote on last edited by
          #41

          I'm still trying to wrap my head around this comment, made by a WPF proponent: "•Disk usage will be slightly less for WPF because it takes so much less code than WinForms. The data will be the same size, of course." I think that maybe he's referring to the size of the target EXE file. I'm not sure how this is relevant to anything that anyone might actually care about, though, and I do not think the generalization this person is making (WPF EXEs will be smaller) is true in any case. I do not even necessarily agree with the "so much less code" part of his argument. I suspect that I could come up with a counterexample. Having worked a great deal with WPF, and having looked at quite a few WPF stack traces in the debugger, my overall feel is that it is a very heavy technology. Sure, it uses the GPU more than WinForms. Unfortunately, it also uses the CPU more than WinForms.

          1 Reply Last reply
          0
          • H hairy_hats

            :-D No I don't, but I do know that "performant" isn't a real word!

            S Offline
            S Offline
            Slacker007
            wrote on last edited by
            #42

            performant is a real word and it is derived from the french language I believe.

            Just along for the ride. "the meat from that butcher is just the dogs danglies, absolutely amazing cuts of beef." - DaveAuld (2011)

            H M 2 Replies Last reply
            0
            • R realJSOP

              No, because as long as there's a series, there's a legend item as well, not to mention the recalculation of the max Y-axis value and the appropriate interval. I'm essentially coloring outside the lines of the "typical" usage.

              ".45 ACP - because shooting twice is just silly" - JSOP, 2010
              -----
              You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
              -----
              "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997

              I Offline
              I Offline
              Ian Shlasko
              wrote on last edited by
              #43

              You can hide the legend for a series... Make a style like:

              <Style x:Key="ChartLegendHidden" TargetType="charting:LegendItem">
              <Setter Property="Template" Value="{x:Null}"/>
              </Style>

              And set the LegendItemStyle of the series to that... Tada, no legend item. Can even use a converter to show/hide the style depending on the visibility of the series.

              Proud to have finally moved to the A-Ark. Which one are you in?
              Author of the Guardians Saga (Sci-Fi/Fantasy novels)

              1 Reply Last reply
              0
              • R realJSOP

                I'm finishing up on a WPF version of Reputationator, and have observed that the WPF app UI is markedly less performant than the WinForms version. Has anyone else done something similar (create a winforms and wpf version of the same app), and then observed similar results? I have to admit that I was somewhat shocked.

                ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                -----
                You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                -----
                "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997

                J Offline
                J Offline
                Jeremy Hutchinson
                wrote on last edited by
                #44

                In our application there is a noticeable delay the first time you view a piece of xaml, but each subsequent time you view it snaps. It's not a big deal in our application because users are slowed a "noticeable" amount only the first time they view a policy or claim, but if they don't close the app for the whole day every policy or claim they view doesn't suffer that same penalty.

                1 Reply Last reply
                0
                • S Slacker007

                  performant is a real word and it is derived from the french language I believe.

                  Just along for the ride. "the meat from that butcher is just the dogs danglies, absolutely amazing cuts of beef." - DaveAuld (2011)

                  H Offline
                  H Offline
                  hairy_hats
                  wrote on last edited by
                  #45

                  If it is a real word it doesn't mean what JSOP thinks it means.

                  S B 2 Replies Last reply
                  0
                  • H hairy_hats

                    If it is a real word it doesn't mean what JSOP thinks it means.

                    S Offline
                    S Offline
                    Slacker007
                    wrote on last edited by
                    #46

                    viaducting wrote:

                    If it is a real word

                    Proof: it's a french based word[^]

                    viaducting wrote:

                    it doesn't mean what JSOP thinks it means.

                    Now that's between you and him. :)

                    Just along for the ride. "the meat from that butcher is just the dogs danglies, absolutely amazing cuts of beef." - DaveAuld (2011)

                    G 1 Reply Last reply
                    0
                    • H hairy_hats

                      If it is a real word it doesn't mean what JSOP thinks it means.

                      B Offline
                      B Offline
                      BillWoodruff
                      wrote on last edited by
                      #47

                      viaducting wrote:

                      If it is a real word it doesn't mean what JSOP thinks it means.

                      If this is a real world, it doesn't mean we are what we think we are. best, Bill

                      "In the River of Delights, Panic has not failed me." Jorge Luis Borges

                      1 Reply Last reply
                      0
                      • S Slacker007

                        viaducting wrote:

                        If it is a real word

                        Proof: it's a french based word[^]

                        viaducting wrote:

                        it doesn't mean what JSOP thinks it means.

                        Now that's between you and him. :)

                        Just along for the ride. "the meat from that butcher is just the dogs danglies, absolutely amazing cuts of beef." - DaveAuld (2011)

                        G Offline
                        G Offline
                        Gary Wheeler
                        wrote on last edited by
                        #48

                        Slacker007 wrote:

                        Proof: it's a french based word[^]

                        Oh, there's a ringing endorsement :rolleyes:.

                        Software Zen: delete this;

                        1 Reply Last reply
                        0
                        • R realJSOP

                          Reputationator isn't NEARLY that complicated. The two comboboxes on the form are populated only once, the two ListViews are ppopulated only once. Only one control (the CheckListBox) is a two-way control (and it's also only populated once). The delay happens whenever I change any criteria for the chart. When the chart criteria change, the existing series are removed, and a new set are added, and the only chart stuff that lives in the XAML are the various data point control templates, so that means that 99% of the chart building happens in the code as opposed to the XAML. The Winforms version essentially does it the same way. I hope to be posting an update to Part 4 of the series with the finished code sometime this weekend. You can look at it then if you want to. It's certainly not a show stopper, but the difference in respovieness is noticable (and I'm running a quad-core 16-gb machine at home).

                          ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                          -----
                          You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                          -----
                          "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997

                          F Offline
                          F Offline
                          Fabio Franco
                          wrote on last edited by
                          #49

                          Assuming that the chart is a drawing task, I also think this is weird, altough I can speculate: Winforms uses GDI+ for drawing and WPF uses DirectX for drawing. DirectX drawing is supposed to be faster, since it uses the video card to perform the rendering. GDI+ uses the processor (software) to perform rendering, so if you got a good processor and a crappy integrated GPU, the rendering might actually be worse with DirectX.

                          "To alcohol! The cause of, and solution to, all of life's problems" - Homer Simpson

                          1 Reply Last reply
                          0
                          • S Slacker007

                            performant is a real word and it is derived from the french language I believe.

                            Just along for the ride. "the meat from that butcher is just the dogs danglies, absolutely amazing cuts of beef." - DaveAuld (2011)

                            M Offline
                            M Offline
                            MSBassSinger
                            wrote on last edited by
                            #50

                            http://dictionary.reference.com/browse/performant[^] It is a word, and has nothing to do with the context in which it was given. Perhaps he meant to use "performance".

                            1 Reply Last reply
                            0
                            • R realJSOP

                              I'm finishing up on a WPF version of Reputationator, and have observed that the WPF app UI is markedly less performant than the WinForms version. Has anyone else done something similar (create a winforms and wpf version of the same app), and then observed similar results? I have to admit that I was somewhat shocked.

                              ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                              -----
                              You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                              -----
                              "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997

                              F Offline
                              F Offline
                              Frank W Wu
                              wrote on last edited by
                              #51

                              This is an illusion when some people don’t know they need to plug VirtualizingStackPanel in to the DataGrid for displaying large-scaled data.

                              1 Reply Last reply
                              0
                              • R realJSOP

                                Do you believe all the blog posts you read? If so, I've seen a few from people that talk about the reptillian aliens that are controlling our planet from secret underground lairs. :)

                                ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                                -----
                                You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                                -----
                                "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997

                                B Offline
                                B Offline
                                Bob work
                                wrote on last edited by
                                #52

                                Do not speak of our benevolent alien overlords! Repent! Repent! (From the Reptilian root "-repost", to eschew responsibility for obfuscatatory text being presented as authoritative data). Oh wait, it's not Labor Day, yet. You're fine. Please continue. :omg:

                                -Bob

                                1 Reply Last reply
                                0
                                • N Nish Nishant

                                  Rama Krishna Vavilala wrote:

                                  That is what I am surprised at. How can reflection and binding can actually lead to better performance then directly adding items? Something is not adding up here. WPF performance issues are mostly due to rendering, so I am more surprised that data-binding or not will improve the performance. Win32 (hence Winforms) rendering is actually faster. Do you know what WPF is doing to optimize the data binding which causes improvement in performance? I doubt they can bypass reflection.

                                  Ok I am not explaining myself well I think. Imagine this scenario, you have a combobox where you want to show country names and another combobox where you want to show state names corresponding to the selected country. (1) Data-binding scenario: Initially, this is slow. Reflection is involved when the data is bound. This is a one-time cost. Now as you change the selection in the country combobox, the states combobox is bound to the selected-item's states property (assume each country object has a states collection). This update automatically happens through property change notifications (assuming you've correctly bound to the selecteditem). (2) Direct manipulation scenario: Initially, this is faster since there's no reflection involved. But consider selection changes. The country combo's selection changed event is handled. Now the user code has to get the new selected item, get the states collection and then manually clear/re-populate the states combobox. In my view (2) is slower in the long run. This gets worse if you have a 3rd bound control, say an image which has to show the country's flag. Now with data-binding this is merely a matter of property change event handling and binding to selected item. With direct manipulation there's more work involved. Not to mention that user written code may have further inefficiencies that may not be obvious. Again I suspect my explanations are probably not very clear so maybe I am not making my point here.

                                  Regards, Nish


                                  My technology blog: voidnish.wordpress.com

                                  D Offline
                                  D Offline
                                  DSewhuk
                                  wrote on last edited by
                                  #53

                                  I wish people didn't use list boxes for states. That is the worst way to select 50+ states with a mobile device using the iPhone spinner control or mouse. It is even worse when they lump our friends up north with New Brunswick in the states list! I punish you to live in NY and select NY from this abomination 1000 times. Lists boxes should not have more than 10 items. This should be taught in UI design 101. Thanks

                                  Dave

                                  D 1 Reply Last reply
                                  0
                                  • R realJSOP

                                    I'm finishing up on a WPF version of Reputationator, and have observed that the WPF app UI is markedly less performant than the WinForms version. Has anyone else done something similar (create a winforms and wpf version of the same app), and then observed similar results? I have to admit that I was somewhat shocked.

                                    ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                                    -----
                                    You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                                    -----
                                    "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997

                                    M Offline
                                    M Offline
                                    Member 96
                                    wrote on last edited by
                                    #54

                                    Yikes! I hope not, we declared the end of Winforms operations for all future dev going forward and I need to port a *huge* app to everything that is not winforms shortly.


                                    There is no failure only feedback

                                    M 1 Reply Last reply
                                    0
                                    • D DSewhuk

                                      I wish people didn't use list boxes for states. That is the worst way to select 50+ states with a mobile device using the iPhone spinner control or mouse. It is even worse when they lump our friends up north with New Brunswick in the states list! I punish you to live in NY and select NY from this abomination 1000 times. Lists boxes should not have more than 10 items. This should be taught in UI design 101. Thanks

                                      Dave

                                      D Offline
                                      D Offline
                                      djdanlib 0
                                      wrote on last edited by
                                      #55

                                      Egads, I know what you mean. It's somewhere in the lower-middle of all lists. Sometimes you have to press N six times, other times 7. I'd rather have auto-complete and just type the abbreviation. Do you have a better design in mind, though? I don't... Maps are too difficult to design well, usually.

                                      D 1 Reply Last reply
                                      0
                                      • R realJSOP

                                        I'm finishing up on a WPF version of Reputationator, and have observed that the WPF app UI is markedly less performant than the WinForms version. Has anyone else done something similar (create a winforms and wpf version of the same app), and then observed similar results? I have to admit that I was somewhat shocked.

                                        ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                                        -----
                                        You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                                        -----
                                        "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997

                                        J Offline
                                        J Offline
                                        JamesHurst
                                        wrote on last edited by
                                        #56

                                        In several years now of building WPF applications, I have rarely seen a visible performance degradation due to WPF as opposed to Winforms or even C++. Yes, I generally leave my compute-intensive video analysis or neural-net computations in C++ and call those routines from the WPF app, but other than that WPF has been extraordinarily productive for me. The main exception was just before 3.5 sp1 came out, and I was doing very-detailed waveforms, that were animated in realtime and feed by 256 sensors. That was pushing the edge. I would love to see exactly where you're perceiving a performance hit, and profile it. I've used Red-Gates ANTS Profiler with good results -- it's a splendid tool (not free, but a heck of a bargain for my needs) and highly recommend it. Other than the animated-waveform project (which I wound up solving in WPF after all) I have never, ever seen a real performance hit in the GUI, relative to Winforms or even C++/MFC/wxWidgets, other than when I had made some coding mistake. I'm talking about the GUI action itself. I noticed amongst the other threads that you're loading something like 500+ objects into a ComboBox? That's not a level that ought to significantly impact your performance, visually - depending upon how fast that source is. But it does merit a think-through on the data-binding strategy. What I often do is handle the data-loading on the content-rendered event, after the view is already visible to the user and before he has time to slide his mouse over to your controls. You have hundreds of milliseconds during that time to play with, without the user perceiving it at all. On the other hand, if you're pulling data through a slow webservice or some such, it might make sense to kick off a work thread immediately, as early as possible, to get those results ready for the GUI. And of course for very large lists - virtual loading is a possibility to consider. There are, too, times when I don't use data-binding at all. It's a useful tool, but I think it's wise to keep an open mind rather than to adhere to the MVVM paradigm religiously. Best of wishes, James W. Hurst

                                        James Hurst "The greatness of a nation and its moral progress can be judged by the way its animals are treated."
                                        Mahatma Gandhi

                                        R 1 Reply Last reply
                                        0
                                        • J JamesHurst

                                          In several years now of building WPF applications, I have rarely seen a visible performance degradation due to WPF as opposed to Winforms or even C++. Yes, I generally leave my compute-intensive video analysis or neural-net computations in C++ and call those routines from the WPF app, but other than that WPF has been extraordinarily productive for me. The main exception was just before 3.5 sp1 came out, and I was doing very-detailed waveforms, that were animated in realtime and feed by 256 sensors. That was pushing the edge. I would love to see exactly where you're perceiving a performance hit, and profile it. I've used Red-Gates ANTS Profiler with good results -- it's a splendid tool (not free, but a heck of a bargain for my needs) and highly recommend it. Other than the animated-waveform project (which I wound up solving in WPF after all) I have never, ever seen a real performance hit in the GUI, relative to Winforms or even C++/MFC/wxWidgets, other than when I had made some coding mistake. I'm talking about the GUI action itself. I noticed amongst the other threads that you're loading something like 500+ objects into a ComboBox? That's not a level that ought to significantly impact your performance, visually - depending upon how fast that source is. But it does merit a think-through on the data-binding strategy. What I often do is handle the data-loading on the content-rendered event, after the view is already visible to the user and before he has time to slide his mouse over to your controls. You have hundreds of milliseconds during that time to play with, without the user perceiving it at all. On the other hand, if you're pulling data through a slow webservice or some such, it might make sense to kick off a work thread immediately, as early as possible, to get those results ready for the GUI. And of course for very large lists - virtual loading is a possibility to consider. There are, too, times when I don't use data-binding at all. It's a useful tool, but I think it's wise to keep an open mind rather than to adhere to the MVVM paradigm religiously. Best of wishes, James W. Hurst

                                          James Hurst "The greatness of a nation and its moral progress can be judged by the way its animals are treated."
                                          Mahatma Gandhi

                                          R Offline
                                          R Offline
                                          realJSOP
                                          wrote on last edited by
                                          #57

                                          Turning off the animations seems to have helped a little.

                                          JamesWittHurst wrote:

                                          I noticed amongst the other threads that you're loading something like 500+ objects into a ComboBox?

                                          I thin you misread something. The combo boxes are loaded statically (in the XAML) at program startup, and together, there are about a dozen items between the two controls. The "500" number is the current approximate number of items in the dataset used by the charts, with a max possible count of 2920) at any given time.

                                          JamesWittHurst wrote:

                                          I think it's wise to keep an open mind rather than to adhere to the MVVM paradigm religiously.

                                          I don't intentionally use any of the named patterns, religiously or otherwise. :) Do you, by any chance, ever answer questions in the Silverlight/WPF forum?

                                          ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                                          -----
                                          You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                                          -----
                                          "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups