loops and ie 7

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • DaveL

    #1

    loops and ie 7

    Hi,
    what is the best sleep method when in long
    loops , running aspx c# 2.0

    i have a situation where i have to loop through a large record set, and
    there is no background thread,
    just code ran from the update button

    is threading.sleep (0) the best option

    thanks
    DaveL


  • =?ISO-8859-1?Q?Arne_Vajh=F8j?=

    #2
    Re: loops and ie 7

    DaveL wrote:
    what is the best sleep method when in long
    loops , running aspx c# 2.0
    >
    i have a situation where i have to loop through a large record set, and
    there is no background thread,
    just code ran from the update button
    >
    is threading.sleep (0) the best option
    What good should that do ?

    The browser will not get anything until you are done.

    And the scheduler will give the CPU to other processes/threads
    anyway.

    Arne

    Comment

    • DaveL

      #3
      Re: loops and ie 7

      its not my code....its a code workers..and he is having problems with cpu
      spiking

      i dont know the answer, thats why im asking here

      DaveL

      "Arne Vajhøj" <arne@vajhoej.d kwrote in message
      news:48a61c7e$0 $90265$14726298 @news.sunsite.d k...
      DaveL wrote:
      >what is the best sleep method when in long
      >loops , running aspx c# 2.0
      >>
      >i have a situation where i have to loop through a large record set, and
      >there is no background thread,
      >just code ran from the update button
      >>
      >is threading.sleep (0) the best option
      >
      What good should that do ?
      >
      The browser will not get anything until you are done.
      >
      And the scheduler will give the CPU to other processes/threads
      anyway.
      >
      Arne

      Comment

      • =?ISO-8859-1?Q?Arne_Vajh=F8j?=

        #4
        Re: loops and ie 7

        DaveL wrote:
        "Arne Vajhøj" <arne@vajhoej.d kwrote in message
        news:48a61c7e$0 $90265$14726298 @news.sunsite.d k...
        >DaveL wrote:
        >>what is the best sleep method when in long
        >>loops , running aspx c# 2.0
        >>>
        >>i have a situation where i have to loop through a large record set, and
        >>there is no background thread,
        >>just code ran from the update button
        >>>
        >>is threading.sleep (0) the best option
        >What good should that do ?
        >>
        >The browser will not get anything until you are done.
        >>
        >And the scheduler will give the CPU to other processes/threads
        >anyway.
        its not my code....its a code workers..and he is having problems with
        cpu
        spiking
        >
        i dont know the answer, thats why im asking here
        If you do some Thread.Sleep calls, then that thread will
        probably give more CPU to other reads, but it will also
        run longer so if there are requests in parallel the
        CPU usage will be the same. And you will use more threads.

        I think you need to attack the core problem and reduce the
        CPU usage of the code.

        Arne

        Comment

        • =?ISO-8859-1?Q?G=F6ran_Andersson?=

          #5
          Re: loops and ie 7

          DaveL wrote:
          its not my code....its a code workers..and he is having problems with cpu
          spiking
          >
          i dont know the answer, thats why im asking here
          >
          DaveL
          >
          "Arne Vajhøj" <arne@vajhoej.d kwrote in message
          news:48a61c7e$0 $90265$14726298 @news.sunsite.d k...
          >DaveL wrote:
          >>what is the best sleep method when in long
          >>loops , running aspx c# 2.0
          >>>
          >>i have a situation where i have to loop through a large record set, and
          >>there is no background thread,
          >>just code ran from the update button
          >>>
          >>is threading.sleep (0) the best option
          >What good should that do ?
          >>
          >The browser will not get anything until you are done.
          >>
          >And the scheduler will give the CPU to other processes/threads
          >anyway.
          >>
          >Arne
          >
          How large is the result, really? Millions of records?

          What is the reason that you have to loop through a large recordset in
          the first place? You can hardly display all the data on the page anyway,
          and even if you did, most of the time would still be cosumed getting the
          data from the database, and getting the page to the user.

          Have you considered if the database can do some of the work? If you are
          comparing the data in some way, that's what the database is built for,
          and it usually does it much better.

          If you really have to do a lot of work, what is the problem with the CPU
          spiking? That's what it does when it works. Code runs at the maximum
          speed all the time, the only reason that you don't see spikes all the
          time is that they are too short to show up.

          --
          Göran Andersson
          _____
          Göran Anderssons privata hemsida.

          Comment

          Working...