Loop fusion
Wikipedia, the free encyclopedia - Cite This SourceLoop fusion, also called loop jamming, is a compiler optimization, a loop transformation, which replaces multiple loops with a single one.
Example in C
int i, a[100], b[100];
for (i = 0; i < 100; i++) {
a[i] = 1;}
for (i = 0; i < 100; i++) {
b[i] = 2;}
is equivalent to:
int i, a[100], b[100];
for (i = 0; i < 100; i++) {
a[i] = 1;
b[i] = 2;}
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 fission.
External links
Wikipedia, the free encyclopedia © 2001-2006 Wikipedia contributors (Disclaimer)
This article is licensed under the GNU Free Documentation License.
Last updated on Wednesday November 28, 2007 at 16:30:18 PST (GMT -0800)
View this article at Wikipedia.org - Edit this article at Wikipedia.org - Donate to the Wikimedia Foundation