WPF Performance
-
Now that's a long story. First it was a web application, but we found the UI to be lacking and inflexible. That's why it became a WinForms application connecting to the server over a webservice. Actually it's two separate clients, one for administration and one for the users. Some modules are shared by both, including libraries with presenters and views. Showing the views in a consistent design was not easy to do when they were imported from a library and at least the user client had to look good. That's why we moved on to WPF and did not regret it. To be honest, by now the user client has moved on to XNA, we have written our own UI for XNA, but it still runs on the same old logic and MVP. Only the views have been replaced, using XAML for our own UI. The administration client will remain with WPF, no need to port that to anything else as well.
"Dark the dark side is. Very dark..." - Yoda ---
"Shut up, Yoda, and just make yourself another toast." - Obi Wan KenobiIsn't XNA A game framework?
Panic, Chaos, Destruction. My work here is done. Drink. Get drunk. Fall over - P O'H OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett
-
Isn't XNA A game framework?
Panic, Chaos, Destruction. My work here is done. Drink. Get drunk. Fall over - P O'H OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett
Once you have a UI that's irrelevant, or not? In combination with a 3D engine you can do really neat stuff. But you are right. It was a game that started out as something like a browser game and then slowly became something entirely different. For me it was a hobby, for another promising young developer it was a start to learn a lot of things and we have quite a few modules which are not only good for writing a game. And it's very well possible that we may soon put that code to some good use like earning some real money.
"Dark the dark side is. Very dark..." - Yoda ---
"Shut up, Yoda, and just make yourself another toast." - Obi Wan Kenobi -
BUT, the winform app is considerably faster (almost instantaneous).
".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, 1997I'm guessing the WinForm app is just drawing dots on a canvas... WPF is creating objects that can respond to mouse events, be animated, be data-bound, etc. Ten times the capability is going to lead to slowdowns. Best way to do it in WPF is to bind to ObservableCollections and make exactly the changes you need on those collections... Don't repopulate with every update. Of course, if you want to do it WinForms-style and lose all of that extra capability, you can write your own graphing component and do the graphics yourself... Just override OnRender (I actually did exactly that yesterday for an intraday stock graph, because I plan on having about 20-30 small ones updating in real-time simultaneously).
Proud to have finally moved to the A-Ark. Which one are you in?
Author of the Guardians Saga (Sci-Fi/Fantasy novels) -
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, 1997For 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
-
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
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 -
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, 1997Doesn'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
-
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, 1997I'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.
-
:-D No I don't, but I do know that "performant" isn't a real word!
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)
-
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, 1997You 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) -
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, 1997In 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.
-
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)
If it is a real word it doesn't mean what JSOP thinks it means.
-
If it is a real word it doesn't mean what JSOP thinks it means.
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)
-
If it is a real word it doesn't mean what JSOP thinks it means.
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
-
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)
Slacker007 wrote:
Proof: it's a french based word[^]
Oh, there's a ringing endorsement :rolleyes:.
Software Zen:
delete this;
-
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, 1997Assuming 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
-
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)
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".
-
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, 1997This is an illusion when some people don’t know they need to plug VirtualizingStackPanel in to the DataGrid for displaying large-scaled data.
-
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, 1997Do 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
-
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
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
-
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