Nullstone Logo

COMPANY
Home
Contacts
Customers
Testimonials

PRODUCTS
Overview
NULLSTONE for C
NULLSTONE for Java
Technical Overview

SUPPORT
Release Notes
Download
PGP Information
Service Report
Write Us

INFORMATION
Performance Results
Glossary of Terms

RELATED LINKS
Compiler Connection
Compiler Jobs

Previous Up Next
Loop Fusion

Some adjacent loops can be fused into one loop to reduce loop overhead and improve run-time performance.

Example:

The two adjacent loops on the code fragment below can be fused into on loop.

    for (i = 0; i < 300; i++)
      a[i] = a[i] + 3;
    
    for (i = 0; i < 300; i++)
      b[i] = b[i] + 4;
    

Below is the code fragment after loop fusion.

    for (i = 0; i < 300; i++)
      {
        a[i] = a[i] + 3;
        b[i] = b[i] + 4;
      }
    

Notes:

Loop fusion is not commonly supported by C compilers.

Although loop fusion reduces loop overhead, it does not always improve run-time performance, and may reduce run-time performance. For example, the memory architecture may provide better performance if two arrays are initialized in separate loops, rather than initializing both arrays simultaneously in one loop.

© 1990-2012 Nullstone Corporation. All Rights Reserved.