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 条
  • [1] Compiler optimization of C++ virtual function calls
    Porat, S
    Bernstein, D
    Fedorov, Y
    Rodrigue, J
    Yahav, E
    PROCEEDINGS OF THE SECOND USENIX CONFERENCE ON OBJECT-ORIENTED TECHNOLOGIES AND SYSTEMS (COOTS), 1996, : 3 - 14
  • [2] Fast static analysis of C++ virtual function calls
    Bacon, DF
    Sweeney, PF
    ACM SIGPLAN NOTICES, 1996, 31 (10) : 324 - 341
  • [3] POSTER: Quantifying the Direct Overhead of Virtual Function Calls on Massively Parallel Architectures
    Zhang, Mengchi
    Green, Roland N.
    Rogers, Timothy G.
    2019 28TH INTERNATIONAL CONFERENCE ON PARALLEL ARCHITECTURES AND COMPILATION TECHNIQUES (PACT 2019), 2019, : 496 - 497
  • [4] C++: function adaptors
    Koenig, Andrew
    Journal of Object-Oriented Programming, 1996, 8 (08):
  • [5] TIME-INVARIANT VIRTUAL MEMBER FUNCTION DISPATCHING FOR C++ EVOLVABLE CLASSES
    VOSS, R
    JOURNAL OF OBJECT-ORIENTED PROGRAMMING, 1994, 7 (07): : 23 - 33
  • [6] Global and Local Virtual Functions in C++
    Heinlein, Christian
    JOURNAL OF OBJECT TECHNOLOGY, 2005, 4 (10):
  • [7] Exceptions in remote procedure calls using C++ template metaprogramming
    Rintala, Matti
    SOFTWARE-PRACTICE & EXPERIENCE, 2007, 37 (03): : 231 - 246
  • [8] vfGuard: Strict Protection for Virtual Function Calls in COTS C plus plus Binaries
    Prakash, Aravind
    Hu, Xunchao
    Yin, Heng
    22ND ANNUAL NETWORK AND DISTRIBUTED SYSTEM SECURITY SYMPOSIUM (NDSS 2015), 2015,
  • [9] Virtual test system based on Visual C++
    Ding, Lipei
    Guo, Xiaosong
    Zhu, Zhi
    ICEMI 2007: PROCEEDINGS OF 2007 8TH INTERNATIONAL CONFERENCE ON ELECTRONIC MEASUREMENT & INSTRUMENTS, VOL II, 2007, : 276 - 278
  • [10] Embedding a C/C++ interpreter into virtual instruments for script blocks
    Duan, Hong
    Cheng, Harry H.
    DETC2007: PROCEEDINGS OF THE ASME INTERNATIONAL DESIGN ENGINEERING TECHNOLOGY CONFERENCE AND COMPUTERS AND INFORMATION IN ENGINEERING CONFERENCE, VOL 4, 2008, : 103 - 116