[Numpy-discussion] performance problem

Christopher Barker Chris.Barker at noaa.gov
Mon Jan 30 16:48:02 CST 2006

Sasha wrote:
> I would recommend to take a look at
> <http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/22007.pdf>

Nice reference, thanks.

 From that:

Copy Frequently Dereferenced Pointer Arguments to Local

Avoid frequently dereferencing pointer arguments inside a
function. Since the compiler has no knowledge of whether
aliasing exists between the pointers, such dereferencing cannot
be optimized away by the compiler. This prevents data from
being kept in registers and significantly increases memory

Note that many compilers have an “assume no aliasing”
optimization switch. This allows the compiler to assume that
two different pointers always have disjoint contents and does
not require copying of pointer arguments to local variables.
Otherwise, copy the data pointed to by the pointer arguments
to local variables at the start of the function and if necessary
copy them back at the end of the function.

Which perhaps helps answer Travis' original question.

Did it make much difference in this case, Travis?


Christopher Barker, Ph.D.
NOAA/OR&R/HAZMAT         (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov

More information about the Numpy-discussion mailing list