No announcement yet.

Execution Speed

  • Filter
  • Time
  • Show
Clear All
new posts

  • Execution Speed

    Hello, well appreciated community!
    At first I thougt about writing a long theoretical question.
    But better to do it simple by telling what I've seen.
    My application uses PB9 and GfxPro. (But I think, it is not a real third-party question).
    The application uses two continous worker threads, carefully separated by the normal stuff of critical-sections, windows-events and context-switching.
    It additionally has a graphical-panel with a lot of GDI-Objects.
    The application works without a problem, showing the thread's execution- speed by changing icons in predefined intervals inside the progamm's main-window statusbar.
    The very strange and the question's origin:
    If one opens another application during runtime of the original program the exucution of the Pb-application explodes. After closing the additional other program it goes back to normal speed.
    I've seen this after opening a web-camera application.
    Another user told me about the same effect by opening internet-explorer.
    All this happens on WinXp.
    You can assume that this does not happen on a regular basis....
    I think it a question of windows- memory organization????
    But I cannot find a way to come closer...
    Maybe You have an idea;
    Many thanks for help and greetings from Germany
    Heinz Grandjean
    Heinz Grandjean

  • #2
    Originally posted by Heinz Grandjean View Post
    the exucution of the Pb-application explodes.
    What do you mean?


    • #3
      Execution time can increase because the new program is taking up time that your program was once using.

      Exection time can decrease becaue the new program may adjust the default duration of a a Windows timeslice in order to get finer timing resolution. This causes all timeslices to be shorter but to occur more frequently so programs which are waiting for something may end up waiting less time and therefore run faster.
      A simple example is if you use "SLEEP 2" in your code. This will try to sleep for 2 msec but a default Windows timeslice is 1/64th second so your code will actually sleep 15-16msec. If the new application adusts the Windows timeslice to 5msec then your code will sleep for 5 instead of 15msec and will then run faster.



      • #4
        I apologize for using the term 'to explode'.
        What I wanted to say: execution speed nearly goes 50% up,
        if another program runs in parallel.

        thank You, I think there is the problem.
        Now the question has to follow concerning the possibilities of manipulating
        the windows timeslice from inside my PB-application.
        Which calls to the windows-api are the correct ones?

        Greetings from Germany
        Heinz Grandjean
        Heinz Grandjean


        • #5
          look here:

          It may give you some ideas.



          • #6
            Thank You Paul for the example.
            I' ve now changed the two worker-threads into two setTimerEvent -functions and it seems to work correctly.

            To my surprise I detected, that I had put the above question twice.
            Sorry for that.

            Greetings from Germany
            Heinz Grandjean
            Heinz Grandjean