Skip to content
John Qase Hacker edited this page Sep 15, 2015 · 2 revisions

Using too much CPU creates heat, which means more energy consumption and errors. Also it's one of the primary resources of your computer. Some of your CPU overhead can be moved to your graphics card (keywords: CUDA, OpenCL). Know how to use that to your advantage.

There are very good techniques for moving processing loads to memory like:

  • memoization,
  • loop unrolling,
  • hash tables.
But before you use these, make sure you're solving the right problem. To paraphrase Jon Bentley, it's no good to compute the wrong problem extremely fast.

Also, it's good to keep in mind the hierarchy of memory: CPU registers (256 bytes), cache (1M), RAM (1G), SWAP (10G), network (1T) (as if). This is a rough order-of-magnitude guide. You'll have to know your system.

Not caring about CPU is like keeping a sports car in 4th gear, when it should be in 5th. Sure you can do it, and it's not really red-lining, but you're making a lot of excess noise, wearing out parts you probably don't know of, and you look utterly foolish to those who actually race cars for a living.

Clone this wiki locally