The direct cost of virtual function calls in C++

被引:31
|
作者
Driesen, K
Holzle, U
机构
[1] Department of Computer Science, University of California, Santa Barbara
关键词
D O I
10.1145/236338.236369
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
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.
引用
收藏
页码:306 / 323
页数:18
相关论文
共 50 条
  • [31] C++
    JOOP - Journal of Object-Oriented Programming, 1998, 10 (09):
  • [32] C++ for ...
    Stevens, A
    DR DOBBS JOURNAL, 1999, 24 (08): : 99 - 101
  • [33] C++
    JOOP J Object Oriented Program, 3 (71):
  • [34] C++
    JOOP J Object Oriented Program, 6 (85):
  • [35] HP C++/SOFTBENCH - A DEVELOPMENT ENVIRONMENT FOR C++
    ARMISTEAD, M
    BURNHAM, J
    JOURNAL OF OBJECT-ORIENTED PROGRAMMING, 1990, 3 (04): : 82 - &
  • [36] Stepping up to C++: Understanding C++ declarations
    Saks, Dan
    C/C++ Users Journal, 1995, 13 (12):
  • [37] Calls to NHS direct
    Sadler, M.
    Challiner, J.
    EMERGENCY MEDICINE JOURNAL, 2008, 25 (01) : 59 - 59
  • [38] Redirection through C++ function pointers - Log statements and debugging
    Trudell, B
    DR DOBBS JOURNAL, 2001, 26 (12): : 56 - +
  • [39] IMPLEMENTING C FUNCTION CALLS IN RULES FOR AN EXPERT SYSTEM SHELL
    MADHAV, BIB
    HEGDE, N
    SIGPLAN NOTICES, 1991, 26 (02): : 64 - 66
  • [40] PAIRING C AND C++
    RANSOM, JF
    DR DOBBS JOURNAL, 1994, 19 (04): : 10 - 10