DSPRelated.com
Forums

Reg: Optimization

Started by Giridhar Tammana July 12, 2006
Hi all,

I'm optimizing code for C64x which was optimized for x86.
In that code lot of lookups were used. I optimized some code by
removing those lookups with the math (reads need 5 cycles).

Are there any other things that should be kept in mind?
like var types static, const.

Thanks,
Giridhar.
Giridhar-

> I'm optimizing code for C64x which was optimized for x86.
> In that code lot of lookups were used. I optimized some code by
> removing those lookups with the math (reads need 5 cycles).
>
> Are there any other things that should be kept in mind?
> like var types static, const.

1) Try to adjust loops so size of critical loop code fits in cache -- that includes
any function calls made by the loop, arrays or other structures used, etc. You have
to look at the .map file to be sure. One little step outside cache during a crucial
loop and you will take a major hit.

2) Any floating-point operations?

3) x86 code often is wasteful with memory. Just a few bits used in arrays of 32-bit
words, tables of pointers to more pointers, etc. Memory is cheap on a PC but not an
embedded DSP board. Suggest to take a close look at use of mem.

-Jeff

PS. You should post this question on c....