loops and ie 7

  • Thread starter Thread starter DaveL
  • Start date Start date
D

DaveL

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
 
DaveL said:
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
 
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
 
DaveL said:
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
 
DaveL said:
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

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top