Abstract
Eliminating Virtual Function Calls in C++ Programs
by: Gerald Aigner and Urs Hï½lzle
Abstract:
We have designed and implemented an optimizing source-to-source C++ compilerthat reduces the frequency of virtual function calls. This technical reportdescribes our preliminary experience with this system. The prototypeimplementation demonstrates the value of OO-specific optimization of C++.Despite some limitations of our system, and despite the low frequency ofvirtual function calls in some of the programs, optimization improves theperformance of a suite of two small and six large C++ applications totallingover 90,000 lines of code by a median of 20% over the original programs andreduces the number of virtual function calls by a median factor of 5. For morecall-intensive versions of the same programs, performance improved by a medianof 40% and the number of virtual calls dropped by a factor of 21. Ourmeasurements indicate that inlining does not necessarily lead to largeincreases in code size, and that for most programs, the instruction cache missratio does not increase significantly.
Keywords:
C++, type feedback, profile-based optimization, compilation, classhierarchy analysis, virtual function calls, Holzle, Hoelzle
Date:
December 1995
Document: 1995-22