Eliminating Virtual Function Calls in C++ Programs

  • Authors:
  • Gerald Aigner;Urs Holzle

  • Affiliations:
  • -;-

  • Venue:
  • Eliminating Virtual Function Calls in C++ Programs
  • Year:
  • 1996

Quantified Score

Hi-index 0.00

Visualization

Abstract

We have designed and implemented an optimizing source-to-source C++ compiler that reduces the frequency of virtual function calls. This technical report describes our preliminary experience with this system. The prototype implementation demonstrates the value of OO-specific optimization of C++. Despite some limitations of our system, and despite the low frequency of virtual function calls in some of the programs, optimization improves the performance of a suite of two small and six large C++ applications totalling over 90,000 lines of code by a median of 20% over the original programs and reduces the number of virtual function calls by a median factor of 5. For more call-intensive versions of the same programs, performance improved by a median of 40% and the number of virtual calls dropped by a factor of 21. Our measurements indicate that inlining does not necessarily lead to large increases in code size, and that for most programs, the instruction cache miss ratio does not increase significantly.