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" <ar**@vajhoej.dkwrote in message
news:48***********************@news.sunsite.dk...
>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
_____
http://www.guffa.com