AnsweredAssumed Answered

While loop optimisation

Question asked by JWellbelove on Jan 16, 2012
Latest reply on Jan 26, 2012 by StuartS

I am fairly new to VisualDSP++ and Blackfin processors.

 

VisualDSP++ provides many optimisation #pragmas for 'for' loops, such as 'vector_for'.

A lot of the code I have iterates over a range between two pointers using a while loop.

 

Would it be advantageous to convert these loops to indexed 'for' loops in order to use these #pragmas?

Or is VisualDSP++ likely to be smart enough to deduce the best optimisation?

 

i.e.

 

while (pBegin != pEnd)

{

    *pDestination++ = *pBegin++;

}

 

Change to...

 

size_t count = pEnd - pBegin;;


#pragma vector_for

for (size_t i = 0; i < count; ++i)

{

     pDestination[i] = pBegin[i];
}

Outcomes