Solved

Loop unrolling

Posted on 2002-07-01
1
250 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

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Inorder binary search tree 5 164
negation in C function 14 153
Programming Arduino to control a Max7219 using C 2 128
Intel debugger, idb, only seeing .c and .h, but no .f90 1 328
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 and use pointers in the C programming language.
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.

777 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