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. General Programming
  3. WPF
  4. WPF Processor Usage

WPF Processor Usage

Scheduled Pinned Locked Moved WPF
csharpwpfquestiondiscussion
11 Posts 4 Posters 31 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.
  • J jlgeris

    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?

    L Offline
    L Offline
    Lost User
    wrote on last edited by
    #2

    Can you post the XAML?

    Cheers, Karl » CodeProject 2008 MVP My Blog | Mole's Home Page | How To Create Screen Capture Videos For Your Articles

    Just a grain of sand on the worlds beaches.

    J 1 Reply Last reply
    0
    • L Lost User

      Can you post the XAML?

      Cheers, Karl » CodeProject 2008 MVP My Blog | Mole's Home Page | How To Create Screen Capture Videos For Your Articles

      Just a grain of sand on the worlds beaches.

      J Offline
      J Offline
      jlgeris
      wrote on last edited by
      #3

      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..

      L 1 Reply Last reply
      0
      • J jlgeris

        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..

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #4

        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 Articles

        Just a grain of sand on the worlds beaches.

        J 1 Reply Last reply
        0
        • L Lost User

          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 Articles

          Just a grain of sand on the worlds beaches.

          J Offline
          J Offline
          jlgeris
          wrote on last edited by
          #5

          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)?

          L M 2 Replies Last reply
          0
          • J jlgeris

            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)?

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #6

            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 Articles

            Just a grain of sand on the worlds beaches.

            J 1 Reply Last reply
            0
            • J jlgeris

              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)?

              M Offline
              M Offline
              Muammar
              wrote on last edited by
              #7

              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) (><)

              J 1 Reply Last reply
              0
              • M Muammar

                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) (><)

                J Offline
                J Offline
                jlgeris
                wrote on last edited by
                #8

                i could do this using GDI w/o a problem...

                J 1 Reply Last reply
                0
                • L Lost User

                  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 Articles

                  Just a grain of sand on the worlds beaches.

                  J Offline
                  J Offline
                  jlgeris
                  wrote on last edited by
                  #9

                  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.

                  L 1 Reply Last reply
                  0
                  • J jlgeris

                    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.

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #10

                    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 Articles

                    Just a grain of sand on the worlds beaches.

                    1 Reply Last reply
                    0
                    • J jlgeris

                      i could do this using GDI w/o a problem...

                      J Offline
                      J Offline
                      Jammer 0
                      wrote on last edited by
                      #11

                      A few thousand points per line does sound like a huge number!

                      Jammer Going where everyone here has gone before! :)

                      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