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 条
  • [21] Refactor conditionals into polymorphism: What's the performance cost of introducing virtual calls ?
    Demeyer, S
    ICSM 2005: PROCEEDINGS OF THE 21ST IEEE INTERNATIONAL CONFERENCE ON SOFTWARE MAINTENANCE, 2005, : 627 - 630
  • [22] 从C++走向标准C++
    张成章
    中文信息, 1999, (01) : 25 - 29
  • [23] C++: C++ in the classroom: a look forward
    Koenig, Andrew
    Journal of Object-Oriented Programming, 1997, 10 (01):
  • [24] The implicit function modeling system - Comparison of C++ and C# solutions
    Karel, U
    Vaclav, S
    C(NUMBER) AND .NET TECHNOLOGIES 2003, WORKSHOP PROCEEDINGS, 2003, : 87 - 92
  • [25] Virtual Pairwise Consistency in Cost Function Networks
    Montalbano, Pierre
    Allouche, David
    de Givry, Simon
    Katsirelos, George
    Werner, Tomas
    INTEGRATION OF CONSTRAINT PROGRAMMING, ARTIFICIAL INTELLIGENCE, AND OPERATIONS RESEARCH, CPAIOR 2023, 2023, 13884 : 417 - 426
  • [26] C++
    Koenig, Andrew
    Moo, Barbara E.
    JOOP - Journal of Object-Oriented Programming, 1999, 12 (01):
  • [27] C++
    Koenig, Andrew
    JOOP - Journal of Object-Oriented Programming, 1997, 10 (07):
  • [28] C++
    Koenig, Andrew
    JOOP - Journal of Object-Oriented Programming, 1998, 11 (02):
  • [29] Standard C/C++: Testing C++ library conformance
    Plauger, P.J.
    C/C++ Users Journal, 2000, 18 (04):
  • [30] C++
    Koenig, Andrew
    1998, (11):