Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the '10.4: Improve Spotlight's search speed' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.4: Improve Spotlight's search speed
Authored by: mistercow on May 10, '05 06:33:49PM

Renice is overrated, although less so than it used to be. Evidence suggests it was entirely broken in pre-Tiger OS X. Even though it works now, renice is not really an effective way to speed things up.

Here's an illustrative example:
Make sure nothing processor intensive is running.
To max out CPU usage you can use the "yes" command in the terminal.

[code]yes x > /dev/null[\code]

That will write the letter x to nowhere as fast as the CPU can. Now look at the yes process in Activity Monitor. What % CPU does it have? Should be around 88-92%.

Now look at its PID. Suppose it's 650. Then in the terminal type
[code]sudo renice -20 650[/code]

Look at Activity Monitor. Has the % CPU changed? Of course not. The CPU time used was already as high as it could be, reserving some time for the system.

The only way you can see any effect from renice is if something else is using a lot of CPU.
If you open up two terminal windows and run yes, you can quickly see that renicing one to -20 gives it a much higher share of CPU time. But it's not going to help when nothing else is taking CPU time.

So if you are having trouble with Spotlight being too slow, for example, renice is rarely going to help. Indeed, the only time it will help you is if the lag experienced with Spotlight is due to something else eating your CPU time.

An apparently common misconception is that most of your CPU isn't being used because of programs' default priority. In OS X, programs already use exactly as much CPU as they need. The only time they use less is when there isn't enough to go around. This is rare.

In short, you aren't going to squeeze any more power out of your CPU than it has to give. If you give Spotlight high priority, you may get it another 10 percent of the CPU. And if Spotlight were relying more on the CPU than say, the hard drive, or any of a dozen other factors, that 10% might even save you a tenth of a second for every hour of use. But practically speaking you're only going to notice a difference because of the placebo effect.

Apple's OS really is using as much of your CPU as it can. Really. Honest.



[ Reply to This | # ]