definitions which have no uses, called dead code. This reduces code size and eliminates unnecessary computation. Factoring out of invariants (loop invariants) If an expression is carried out both when a condition is met and is not met, it can be written just once outside of the conditional statement. Similarly, if certain types of expressions (e.g., the assignment of a constant into a variable) appear inside a loop, they can be moved out of it because their effect will be the same no matter if they're executed many times or just once. This is also known as total redundancy elimination. A similar but more powerful optimization is partial-redundancy elimination (PRE). Inline expansion or macro expansion When some code invokes a procedure, it is possible to directly insert the body of the procedure inside the calling code rather than transferring control to it. This saves the overhead related to procedure calls, as well as providing an opportunity for many different parameter-specific optimizations, but comes at the cost of space; the procedure body is duplicated each time the procedure is called inline. Generally, inlining is useful in performance-critical code that makes a large number of calls to small procedures. A "fewer jumps" optimization. The statements of imperative programming languages are also an example of such an optimization. Although statements could be implemented with function calls they are almost always implemented with code inlining. Jump threading In this optimization, consecutive conditional jumps predicated entirely or partially on the same condition are merged. E.g., to , and to . Macro compression A space optimization that recognizes common sequences of code, creates subprograms ("code macros") that contain the common code, and replaces the occurrences of the common code sequences with calls to the corresponding subprograms. This is most effectively done as a machine code optimization, when all the code is present. The technique was first used to conserve space in an interpretive byte stream used in an implementation of Macro Spitbol on microcomputers. The problem of determining an optimal set of macros that minimizes the space required by a given code segment is known to be NP-complete, but efficient heuristics attain near-optimal results. Reduction of cache collisions (e.g., by disrupting alignment within a page) Stack-height reduction Rearrange expression tree to minimize resources needed for expression evaluation. Test reordering If we have two tests that are the condition for something, we can first deal with the