Empirical Lab Repository

Title: Measuring Java's Method Call Overhead

Author: Grant W. Braught, Dickinson College, braught@dickinson.edu

Possible courses: Computer Organization and Architecture

Empirical Concepts Used: average, percent

Empirical Concepts Introduced: experiment design, isolation of variables

Computer Science Concepts Used: control structures, method calling, static methods, class implementation, instance methods

Summary: In this assignment, students measure the overhead associated with making static and instance method calls in Java. The main purpose of this assignment is to provide students with the opportunity to explicitly examine the trade offs involved in using Structured and Object Oriented programming techniques. In the context of a computer organization and architecture course this means that students see first-hand the impact of the method calling protocol on performance. Students are also exposed to a simple profiling tool and techniques for measuring the performance of their programs.

The assignment outlines a procedure for measuring the performance of a simple program in which all of the code is contained in the main method. The students are then required to perform similar measurements for two other programs that execute the same code in a static method and in an instance method. Students must be careful in their experimental design to measure only the method call overhead and not also the overhead associated with the code execution or object creation.

Variations: The materials provided are Java specific. However, the assignment idea should easily generalize to any language for which an adequate profiler is available.