loading...
Refactor Conditionals into Polymorphism: What's the Performance Cost of Introducing Virtual Calls?
Budapest, Hungary September 25-September 30
DOI Bookmark: http://doi.ieeecomputersociety.org/10.1109/ICSM.2005.7421st IEEE International Conference on ...
 This Article 
 
PDF
HTML
 
 Share 
   
 Bibliographic References 
   
 Add to: 
 
Digg
Furl
Spurl
Blink
Simpy
Google
Del.icio.us
Y!MyWeb
 
 Search 
   
Serge Demeyer, University of Antwerp
The notion of refactoring — transforming the source-code of an object-oriented program without changing its external behavior — has been embraced by many object-oriented software developers as a way to accommodate changing requirements. If applied well, refactoring improves the maintainability of the software. However, it is believed that it does so at the sake of performance. Especially in a C++ context, the introduction of virtual function calls is often blamed for performance reduction because it introduces an extra indirection via the so-called virtual function table. To investigate the performance trade-off involved when introducing virtual functions, we compared the execution time of four benchmark programs which contain large conditionals against refactored versions where the conditionals were replaced by virtual function calls. Depending on the compiler and compiler optimizations being used, we discovered that C++ programs refactored this way often perform faster than their non-refactored counterparts, hence advise programmers not to obfuscate their programs with conditional logic in order to obtain good performance.
Citation:
Serge Demeyer, "Refactor Conditionals into Polymorphism: What's the Performance Cost of Introducing Virtual Calls?," icsm, pp.627-630, 21st IEEE International Conference on Software Maintenance (ICSM'05), 2005
Usage of this product signifies your acceptance of the Terms of Use.