Language-Dependent performance of design patterns

  • Authors:
  • Edward A. Billard

  • Affiliations:
  • California State University, Hayward, CA

  • Venue:
  • ACM SIGSOFT Software Engineering Notes
  • Year:
  • 2003

Quantified Score

Hi-index 0.00

Visualization

Abstract

The Gang of Four design patterns represent a catalog of 23 reusable design solutions to classes of problems that arise in a variety of applications. This study examines the execution performance of the patterns, as implemented in C++, Java (native and JDK 1.0 through 1.4), Smalltalk, and Perl 5.0. Each pattern is implemented independent of an application and, hence, represents just the pure object structure. Because the patterns themselves demonstrate a variety of structures, the results represent a good benchmark for how well the object-oriented compilers actually handle object-oriented programming, in particular, object creation and object reference to methods/attributes. The results indicate that the C++ compiler provided the fastest code, Java was second, followed by Smalltalk, and then Perl. However, Java 1.2 and 1.4 held their own against the optimized version of C++ and even did slightly better than non-optimized C++. Optimized C++ code was the best in 11 of the 23 patterns, with Java 1.2 and 1.4 sharing the remaining honors for the other 12 patterns, that is, a "winning" Java compiler can be found for just over half of the design patterns. Smalltalk was an order of magnitude, and Perl two orders of magnitude, slower. Although there is a wide variety of performance among the design patterns, the overall averages are much in-line with the averages of four simple test programs. The results may provide guidelines for future application development.