From Generic Invocations to Generic Implementations
Other conference contribution, 2006

Software performance benefits from executing computations on constant data statically, at compile time. Unlike most languages, C++ allows expressing static computations by language means (template meta-programming), without relying on separate preprocessing tools. However, static code differs from dynamic code by syntax and even by programming style, as the former is functional, the latter imperative. A library designer who wants to support both a static and a dynamic version of an algorithm is therefore forced to design and maintain two implementations. A common formulation is presented that allows one to implement an algorithm generically by a single definition, while encoding static parameter properties within the argument types. By the choice of argument representation, the user determines how the algorithm is evaluated. This decoupling preserves all information necessary to have the compiler create appropriate code for each case. The realization by an ANSI C++ library of static constructs guarantees portability and allows an optimizing compiler to eliminate run-time overhead.

library-based software

C++

meta programming

code optimization

staging

generic programming

Author

Andreas Priesnitz

Chalmers, Computer Science and Engineering (Chalmers), Computing Science (Chalmers)

Sibylle Schupp

Chalmers, Computer Science and Engineering (Chalmers), Computing Science (Chalmers)

5th Workshop on Parallel/High-Performance Object-Oriented Scientific Computing at the 20th European Conference on Object Oriented Programming - POOSC'06 Workshop Notes

Subject Categories

Software Engineering

Computer Science

More information

Created

10/6/2017