Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

(no subject)



Sorry this is probably a very basic question, as I don't have a strong knowledge in the field, but here is my question.

I use Shark to optimize some of my code (so far, ~3-4 fold increase, after ~ half a dozen hot spots were fixed). However, I found in many places the comment 'Invariant load', typically when looping over an array and using the loop variable as the index (this particular code is not worth any optimization, it is just the simplest example I could find in my code):

/* int i ; double *dsdrate,*dsdr */
for (i=0;i<countSpecies;i++)	/* Invariant load, Early exit */
	dsdrate[i]=dsdr[i];	/* Invariant load, Unroll, Unaligned loop start */

So what exactly is causing these 'Invariant load' warnings from Shark? It seems it disappears when I increment a pointer inside the loop instead, like so (I did not test that particular code in Shark, though):
double *p1=dsdrate;
double *p2=dsdr;
for (i=0;i<countSpecies;i++) {
	*p1=*p2;
	p1++;
	p2++;
}

There are maybe a couple of places where I could do some optimization on those 'Invariant load' warnings. Thanks for your input!

charles

-- 
Charles Parnot
email@hidden

Help science go fast forward:
http://cmgm.stanford.edu/~cparnot/xgrid-stanford/

Room  B157 in Beckman Center
279, Campus Drive
Stanford University
Stanford, CA 94305 (USA)

Tel +1 650 725 7754
Fax +1 650 725 8021
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
PerfOptimization-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/perfoptimization-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.