Publications Details
Optimization of expressions involving array classes
C++ is rapidly gaining in popularity as a scientific programming language. The data encapsulation inherent in the class concept and the availability of operator overloading for compact representation of operations make it an ideal language for translating concepts in mathematical physics into computer code. Furthermore, its strong type checking and memory management features facilitate correct coding of algorithms. Unfortunately, C++ code which is written in the true spirit of the language is often very inefficient under current compiler implementations. Many of the inefficiency issues, such as unnecessary copy operations or proliferation of temporaries, have been well-characterized. Some may be alleviated by clever C++ coding, but others cannot be alleviated except by writing C-like code that sacrifices one or more of the best features of the language. This document describes a major source of efficiency problems in expressions using overloaded operators on array classes, and proposes certain minor modifications to the C++ language standard which will facilitate optimization of these expressions.