Conclusion
In many real life systems, the application performance is far from optimal. A lot of improvement can often be achieved by measuring how the system behaves and configuring the system optimally (regarding memory, disk I/O, network, and so forth).
If you have access to the application source code, compiling with the latest compiler version and with compiler optimization enabled will make a significant improvement. In most cases, compiling with -fast is a very good start. Also, keeping the code as simple as possible and using optimized libraries when possible helps a lot.