Java reduce CPU usage

Posted by steve on Stack Overflow See other posts from Stack Overflow or by steve
Published on 2010-03-28T12:24:36Z Indexed on 2010/03/28 12:33 UTC
Read the original article Hit count: 209

Filed under:
|
|

Greets-

We gots a few nutters in work who enjoy using

while(true) { //Code } 

in their code. As you can imagine this maxes out the CPU. Does anyone know ways to reduce the CPU utilization so that other people can use the server as well.

The code itself is just constantly polling the internet for updates on sites. Therefore I'd imagine a little sleep method would greatly reduce the the CPU usage.

Also all manipulation is being done in String objects (Java) anyone know how much StringBuilders would reduce the over head by?

Thanks for any pointers

© Stack Overflow or respective owner

Related posts about java

Related posts about cpu-usage