Maximizing Performance
Your Raspberry Pi seems to be very slow, so you want to overclock it to make it run faster.
You can increase the clock frequency of a Raspberry Pi to make it run a little faster. This will make it use a bit more power and run a little hotter (see the Discussion next).
The method of overclocking described here is called dynamic overclocking because it automatically monitors the temperature of the Raspberry Pi and drops the clock speed back down if things start to get too hot.
To make your Pi overclock, run the raspi_config utility by issuing the following command in a Terminal:
$ sudo raspi-config |
Select the overclock option in the menu, and you are presented with the options in Figure 1-12.
Select an option. If you find that your Raspberry Pi starts to become unstable and hangs unexpectedly, then you may need to choose a more conservative option or turn overclocking off by setting it back to None.
Discussion
The performance improvements from overclocking can be quite dramatic. To measure these, I used a Raspberry Pi model B, revision 2, without a case at an ambient room temperature of 15 degrees C.
The test program was the following Python script. This just hammers the processor and is not really representative of the other things that go on in a computer, such as writing to the SD card, graphics, and so on. But it does give a good indication of raw CPU performance if you want to test the effect of overclocking on your Raspberry Pi.
import time def factorial(n): if n == 0: return 1 else: return n * factorial(n-1) before_time = time.clock() for i in range(1, 10000): factorial(200) after_time = time.clock() print(after_time – before_time) |
Check out the results of the test in Table 1-2.
As you can see, the performance has increased by 33%, but at a cost of drawing more current and a slightly higher temperature.
You can now buy self-adhesive heatsinks that fit onto the big chip at the center of the Raspberry Pi to help keep it cool. Some of these do not actually connect the heatsink to the chip with a thermally conductive compound and are therefore mostly for show. A well-ventilated enclosure (Recipe 1.2) may well be more effective. There have also been some efforts to add water-cooling to the Raspberry Pi. Frankly, this is just silly.
See Also
You can find much more information about the raspi-config tool at http://elinux.org/RPi_raspi-config.
Table 1-2. Overclocking | |||
Speed test | Current | Temperature (degrees C) | |
700 MHz | 15.8 seconds | 360 mA | 27 |
1 GHz | 10.5 seconds | 420 mA | 30 |