In my quest to speed up my Mac, I learned about two utilities that I wish someone had shown me years ago: say hello to ‘purge’ and ‘fs_usage’.
1) The absolute slowest thing a modern computer can do is hit the disk. fs_usage shows you all of the disk accesses in realtime, so you can have a look at what’s using the disk(s). It’s a lot of information and there are a number of options, but just a quick look at it was enough to tell me that spotlight was spending a tremendous amount of time indexing my spam folder which had accumulated a few hundred thousand messages. Removing those for good sped up my machine quite a bit. This must be run as root or sudo.
2) Inactive memory (which is memory that has been recently used but is no longer) is supposed to be seamlessly reclaimed automatically by the OS when needed for new programs. In practice, I’ve found that this isn’t the case, and my system slows to a crawl and starts paging out to disk when free memory drops to zero, even as half of the available RAM (which is a lot) is marked as inactive. I suspect that this may have something to do with the particular programs I’m running and how they allocate memory, but I don’t really know the OSX internal specifics beyond that. The purge command clears the cache and converts inactive memory to free. This can slow you down if something actually wants to use that inactive memory again, but in practice I find that I have a much bigger problem with a lack of available free memory. If you don’t have this problem, you don’t need to worry about it. This doesn’t need to be run as root. You may not have it - it seems it might be included with Lion, but it’s unclear. If not, you can get it with Xcode.