[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 283
  • Last Modified:

Loop unrolling

What are loop overheads? How are they overcome by unrolling?

Please let me know

Thanks,
Arut
0
arut
Asked:
arut
1 Solution
 
jkrCommented:
A 'loop overhead' is e.g.

int i;

for ( i = 0; i < 3; i++) {

 printf ( "i: %d\n", i);
}

Here, checking whether 'i' is smaller than 3 is the overhead.

'Unrolling' would make it

 printf ( "i: %d\n", i);
 printf ( "i: %d\n", ++i);
 printf ( "i: %d\n", ++i);

thus avoiding the overhead. But, you can also see the limitations if the loop bound is not constant.
0

Featured Post

Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now