Dynamic algorithm selection for runtime concepts

  • Authors:
  • Peter Pirkelbauer;Sean Parent;Mat Marcus;Bjarne Stroustrup

  • Affiliations:
  • Texas A&M University, College Station, TAMU 3112, TX 77843, USA;Adobe Systems Inc., San Jose, CA, USA;-;Texas A&M University, College Station, TAMU 3112, TX 77843, USA

  • Venue:
  • Science of Computer Programming
  • Year:
  • 2010

Quantified Score

Hi-index 0.00

Visualization

Abstract

A key benefit of generic programming is its support for producing modules with clean separation. In particular, generic algorithms are written to work with a wide variety of types without requiring modifications to them. The Runtime concept idiom extends this support by allowing unmodified concrete types to behave in a runtime polymorphic manner. In this paper, we describe one implementation of the runtime concept idiom, in the domain of the C++ standard template library (STL). We complement the runtime concept idiom with an algorithm library that considers both type and concept information to maximize performance when selecting algorithm implementations. We present two implementations, one in ISO C++ and one using an experimental language extension. We use our implementations to describe and measure the performance of runtime-polymorphic analogs of several STL algorithms. The tests demonstrate the effects of different compile-time vs. run-time algorithm selection choices.