WPF Processor Usage
-
Via a Canvas and 6 polylines, I have a good amount of data plotted on the screen, and I've noticed that even without updated the polylines (changing their values), the processor becomes bogged down when I simply move the cursor over the canvas. I realize the OS must redraw the screen when the mouse moves, but could there be something with the way I'm using the Canvas, that creates unnecessary rendering? I mean, all I'm doing is moving the mouse anywhere over the canvas, and I experience a processor usage jump of ~50-60%. I'm not using a MouseOver event either. Any thoughts?
Can you post the XAML?
Cheers, Karl
» CodeProject 2008 MVP My Blog | Mole's Home Page | How To Create Screen Capture Videos For Your ArticlesJust a grain of sand on the worlds beaches.
-
Can you post the XAML?
Cheers, Karl
» CodeProject 2008 MVP My Blog | Mole's Home Page | How To Create Screen Capture Videos For Your ArticlesJust a grain of sand on the worlds beaches.
-
in the current application, i'm not continuously updating the gridlines or polylines. I've simply added points to them, and then displayed them. there's not a whole lot of code other than that..
jlgeris wrote:
What is the Code tag? The above runs like a rocket ship on my system. 0% CPU. Your lines don't have any x or y so they are all super small and don't do anything.
Cheers, Karl
» CodeProject 2008 MVP My Blog | Mole's Home Page | How To Create Screen Capture Videos For Your ArticlesJust a grain of sand on the worlds beaches.
-
jlgeris wrote:
What is the Code tag? The above runs like a rocket ship on my system. 0% CPU. Your lines don't have any x or y so they are all super small and don't do anything.
Cheers, Karl
» CodeProject 2008 MVP My Blog | Mole's Home Page | How To Create Screen Capture Videos For Your ArticlesJust a grain of sand on the worlds beaches.
the Code tag was me not entering my code in correctly into the meassge box :) well, i set the xy's in the c# code. it's hard for me to show, b/c the system slows when i add a few thousand points to each of the polyline. common sense says, right, there's a lot of data in memory to plot these lines, but i wouldn't expect so much processing when i'm not manipulating the data contained in the polylines. when i move the mouse over the plot, is it invalidating the image every movement(forcing a re-render)?
-
the Code tag was me not entering my code in correctly into the meassge box :) well, i set the xy's in the c# code. it's hard for me to show, b/c the system slows when i add a few thousand points to each of the polyline. common sense says, right, there's a lot of data in memory to plot these lines, but i wouldn't expect so much processing when i'm not manipulating the data contained in the polylines. when i move the mouse over the plot, is it invalidating the image every movement(forcing a re-render)?
jlgeris wrote:
when i move the mouse over the plot, is it invalidating the image every movement(forcing a re-render)?
Do you have any RoutedEvent handlers in your application? Are these lines being constructed with code or are they databound to a class/properties? What role does the mouse play in your application?
Cheers, Karl
» CodeProject 2008 MVP My Blog | Mole's Home Page | How To Create Screen Capture Videos For Your ArticlesJust a grain of sand on the worlds beaches.
-
the Code tag was me not entering my code in correctly into the meassge box :) well, i set the xy's in the c# code. it's hard for me to show, b/c the system slows when i add a few thousand points to each of the polyline. common sense says, right, there's a lot of data in memory to plot these lines, but i wouldn't expect so much processing when i'm not manipulating the data contained in the polylines. when i move the mouse over the plot, is it invalidating the image every movement(forcing a re-render)?
-
jlgeris wrote:
he system slows when i add a few thousand points to...
Funny :laugh:
Smile: A curve that can set a lot of things straight! (\ /) (O.o) (><)
-
jlgeris wrote:
when i move the mouse over the plot, is it invalidating the image every movement(forcing a re-render)?
Do you have any RoutedEvent handlers in your application? Are these lines being constructed with code or are they databound to a class/properties? What role does the mouse play in your application?
Cheers, Karl
» CodeProject 2008 MVP My Blog | Mole's Home Page | How To Create Screen Capture Videos For Your ArticlesJust a grain of sand on the worlds beaches.
I have some event handlers for other controls, but not relating to the canvas. The lines are being constructed with code, basically: PointCollection pc = BunchOfPoints; polyline.points = pc; this is done 6 times Right now the mouse doesn't play a role. I would like to be able to manipulate the display, but right now the system slows down if i simply move the mouse over.
-
I have some event handlers for other controls, but not relating to the canvas. The lines are being constructed with code, basically: PointCollection pc = BunchOfPoints; polyline.points = pc; this is done 6 times Right now the mouse doesn't play a role. I would like to be able to manipulate the display, but right now the system slows down if i simply move the mouse over.
I guess we have ruled out the obvious. Is there any way to reduce the number of points? I'm not sure what your doing or why, so I have to spitball here. Can you average points to reduce the number of points? Can you end user see the difference between 1000 points and 500 points? Are the values between each point that great, if not then you can plot every 2nd, 3rd, 4th, etc point.
Cheers, Karl
» CodeProject 2008 MVP My Blog | Mole's Home Page | How To Create Screen Capture Videos For Your ArticlesJust a grain of sand on the worlds beaches.