The direct cost of virtual function calls in C++
Authors:
Open Access
- 1 October 1996
- journal article
- Published by Association for Computing Machinery (ACM) in ACM SIGPLAN Notices
- Vol. 31 (10) , 306-323
Abstract
We study the direct cost of virtual function calls in C++ programs, assuming the standard implementation using virtual function tables. We measure this overhead experimentally for a number of large benchmark programs, using a combination of executable inspection and processor simulation. Our results show that the C++ programs measured spend a median of 5.2% of their time and 3.7% of their instructions in dispatch code. For "all virtuals" versions of the programs, the median overhead rises to 13.7% (13% of the instructions). The "thunk" variant of the virtual function table implementation reduces the overhead by a median of 21% relative to the standard implementation. On future processors, these overheads are likely to increase moderately.Keywords
This publication has 9 references indexed in Scilit:
- Profile-guided receiver class prediction1995
- EELACM SIGPLAN Notices, 1995
- Optimizing dynamically-dispatched calls with run-time type feedback1994
- Reducing indirect function call overhead in C++ programs1994
- An efficient implementation of SELF a dynamically-typed object-oriented language based on prototypesACM SIGPLAN Notices, 1989
- Fast dispatch mechanisms for stock hardwareACM SIGPLAN Notices, 1988
- What Price Smalltalk?Computer, 1987
- Multiple inheritance in Simula-like languagesBIT Numerical Mathematics, 1985
- Efficient implementation of the smalltalk-80 system1984