Evaluating Virtual Dispatch Mechanisms for C++

Polymorphism, supported in C++ via virtual functions, is the ability to call a variety of functions with the same signature from the same call site. This feature improves the flexibility of C++ programs, and helps programmers write extensible software. Nevertheless, these benefits come with a performance price. This paper explores space and time overhead of virtual dispatch mechanisms that implement polymorphism in C++. How polymorphism is implemented depends on the object model; that is, the specific structures and mechanisms used to support the object-oriented features of a language. In particular, this study holds the object layout fixed, and varies the VFT layout to determine the time and space overhead of the virtual dispatch mechanisms for four different VFT layouts. The object model that is used is generally known and is used in a production compiler, and the four VFT layouts that are evaluated are either generally known or else used in a production compiler. This paper is the first study, known to the authors, that quantitatively compares VFT layouts.

By: Harini Srinivasan and Peter F. Sweeney

Published in: RC20330 in 1996


This Research Report is available. This report has been submitted for publication outside of IBM and will probably be copyrighted if accepted for publication. It has been issued as a Research Report for early dissemination of its contents. In view of the transfer of copyright to the outside publisher, its distribution outside of IBM prior to publication should be limited to peer communications and specific requests. After outside publication, requests should be filled only by reprints or legally obtained copies of the article (e.g., payment of royalties). I have read and understand this notice and am a member of the scientific community outside or inside of IBM seeking a single copy only.


Questions about this service can be mailed to reports@us.ibm.com .