Loop fusion
Encyclopedia
Loop fusion, also called loop jamming, is a compiler optimization
, a loop transformation, which replaces multiple loops with a single one.
is equivalent to:
.
Compiler optimization
Compiler optimization is the process of tuning the output of a compiler to minimize or maximize some attributes of an executable computer program. The most common requirement is to minimize the time taken to execute a program; a less common one is to minimize the amount of memory occupied...
, a loop transformation, which replaces multiple loops with a single one.
Example in C
is equivalent to:
Note
Some optimizations like this don't always improve the run-time performance. This is due to architectures that provide better performance if there are two loops rather than one, for example due to increased data locality within each loop. In those cases, a single loop may be transformed into two, which is called loop fissionLoop fission
Loop fission is a compiler optimization technique attempting to break a loop into multiple loops over the same index range but each taking only a part of the loop's body. The goal is to break down large loop body into smaller ones to achieve better utilization of locality of reference. It is the...
.