This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: optimisation question


Remy X.O. Martin wrote:

Hello,

I spent some time with Apple's Shark yesterday, profiling some of my code (rather, running a particular batch). Shark is a tool which samples running applications, and then allows one to find the most expensive expressions, giving hardware-specific suggestions on how to improve performance. I got 3 suggestions:

1) use a specific compiler option (-mdynamic-no-pic)
2) statements like a= c= d; are not (necessarily) optimal
3) Rewrite for( i= 0; i< dest->N; i++ ) dest->array[i]= SOME_EXPRESSION;
as (e.g.)
for( i= 0, N=dest->N, array=dest->array; i< N; i++ ) array[i]= SOME_EXPRESSION;




I'm not sure about 1 and 2. The main problem with 3 is that it may hard to tell array[i] = SOME_EXPRESSION cannot effect dest->N or dest->array. Unless SOME_EXPRESSION contains a function this would however suprise me. The alising code has got better in the current CVS. If you have a specific example then that would be interesting to see.

Chris


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]