Solved

Loop unrolling

Posted on 2002-07-01
1
230 Views
Last Modified: 2010-04-15
What are loop overheads? How are they overcome by unrolling?

Please let me know

Thanks,
Arut
0
Comment
Question by:arut
1 Comment
 
LVL 86

Accepted Solution

by:
jkr earned 100 total points
ID: 7121621
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now