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. C / C++ / MFC
  4. Some help for Loop's

Some help for Loop's

Scheduled Pinned Locked Moved C / C++ / MFC
performancehelp
7 Posts 6 Posters 0 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.
  • F Offline
    F Offline
    faroqtam
    wrote on last edited by
    #1

    Hi I need some help for the follwoing state. when i use for(....) statement the CPU prformance becomes 100% when i use Sleep(..) function the program performance becomes more slower. i need some techinques for using loop with large rang with minmal CPU performance . plesea some help. thanx alot BY. On Earth nothing impossible, while your mind running. Faroqtam

    J M R N T 5 Replies Last reply
    0
    • F faroqtam

      Hi I need some help for the follwoing state. when i use for(....) statement the CPU prformance becomes 100% when i use Sleep(..) function the program performance becomes more slower. i need some techinques for using loop with large rang with minmal CPU performance . plesea some help. thanx alot BY. On Earth nothing impossible, while your mind running. Faroqtam

      J Offline
      J Offline
      John R Shaw
      wrote on last edited by
      #2

      If you are processing a lot of data, Sleep is about your only choice. You must chose between fast data processing and program performace. It is all a balancing act; a single CPU can only do so much and every but wants a slice of its time. The best you can do is to run profiling to see where the bottle necks are (slow code) and optimize those functions that are taking to long to do there job. Good Luck! INTP "The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes." Andrew W. Troelsen

      1 Reply Last reply
      0
      • F faroqtam

        Hi I need some help for the follwoing state. when i use for(....) statement the CPU prformance becomes 100% when i use Sleep(..) function the program performance becomes more slower. i need some techinques for using loop with large rang with minmal CPU performance . plesea some help. thanx alot BY. On Earth nothing impossible, while your mind running. Faroqtam

        M Offline
        M Offline
        Maximilien
        wrote on last edited by
        #3

        What exacly you want to do ? why would you want to use Sleep ? it will stop the loop from looping ( and suspend the application ). If the software loops, and is taking 100% of the CPU, it is because the OS decided that nothing else important needs the CPU; I'm not sure what you mean by "minmal CPU performance" ? even a low priority process will be put to work when nothing else happens.


        Maximilien Lincourt Your Head A Splode - Strong Bad

        1 Reply Last reply
        0
        • F faroqtam

          Hi I need some help for the follwoing state. when i use for(....) statement the CPU prformance becomes 100% when i use Sleep(..) function the program performance becomes more slower. i need some techinques for using loop with large rang with minmal CPU performance . plesea some help. thanx alot BY. On Earth nothing impossible, while your mind running. Faroqtam

          R Offline
          R Offline
          Ravi Bhavnani
          wrote on last edited by
          #4

          See the section "Responding to user input while performing a long task" in this[^] article. /ravi My new year's resolution: 2048 x 1536 Home | Articles | Freeware | Music ravib@ravib.com

          F 1 Reply Last reply
          0
          • F faroqtam

            Hi I need some help for the follwoing state. when i use for(....) statement the CPU prformance becomes 100% when i use Sleep(..) function the program performance becomes more slower. i need some techinques for using loop with large rang with minmal CPU performance . plesea some help. thanx alot BY. On Earth nothing impossible, while your mind running. Faroqtam

            N Offline
            N Offline
            namaskaaram
            wrote on last edited by
            #5

            ;)well if the processing that u want to is not that important ,give ur code in the OnIdle() function..... maybe that could help.....:~

            1 Reply Last reply
            0
            • F faroqtam

              Hi I need some help for the follwoing state. when i use for(....) statement the CPU prformance becomes 100% when i use Sleep(..) function the program performance becomes more slower. i need some techinques for using loop with large rang with minmal CPU performance . plesea some help. thanx alot BY. On Earth nothing impossible, while your mind running. Faroqtam

              T Offline
              T Offline
              toxcct
              wrote on last edited by
              #6

              set a timer to perform your task at a time interval without using CPU when your program's not running (active loops are bad for that).


              TOXCCT >>> GEII power
              [VisualCalc]

              1 Reply Last reply
              0
              • R Ravi Bhavnani

                See the section "Responding to user input while performing a long task" in this[^] article. /ravi My new year's resolution: 2048 x 1536 Home | Articles | Freeware | Music ravib@ravib.com

                F Offline
                F Offline
                faroqtam
                wrote on last edited by
                #7

                Hi . Thanx alot. On Earth nothing impossible, while your mind running. Faroqtam

                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