Besides the stock kernel there are several performance-optimised kernel patches available on the internet. One of the most popular is made by Linux kernel developer Con Kolivas, who assembles it from lots of different performance patches.
To install it, use your distro’s package manager to first download the kernel source for the version the patch applies to, along with all the tools for building your kernel.
Then download the patch from Koliva’s website (http://users.on.net/ ckolivas/kernel) and use the patch command in the kernel source folder to apply the changes, such as sudo patch -p1 < patch-4.*-ck1. Then just follow your distribution’s instructions to build the kernel.
Ubuntu users can try to automate the process by downloading and modifying the script at http://bit.ly/lud_kernel which will download a vanilla kernel along with Kolivas’ patches and compile them into installable binaries for you.