Optimization - Changing Dependencies

Introduction
This is a meta-optimisation pattern. Often we will find that the dependencies that our program used are too slow, and that converting to different implementations (while possibly having to re-implement or port part of the code) will make the program significantly slower. Examples:


 * Many operations in P-code languages (or at least those without Just-in-time compilation would be too slow and implementing them in a language that gets compiled to efficient machine code will make it faster. For example converting Perl/Python/Ruby/PHP/Tcl/etc. code to C or C++.
 * Some libraries or APIs may be slower than their alternatives, or alternatively faster, dedicated, and custom code can be written to replace them.

Sub patterns

 * Reducing network traffic.
 * Moving from hard-disk access to memory access, memory access to register access, etc.