Adding tuples to Java: a study in lightweight data structures

  • Authors:
  • C. van Reeuwijk;H. J. Sips

  • Affiliations:
  • Delft University of Technology, Delft, The Netherlands;Delft University of Technology, Delft, The Netherlands

  • Venue:
  • JGI '02 Proceedings of the 2002 joint ACM-ISCOPE conference on Java Grande
  • Year:
  • 2002

Quantified Score

Hi-index 0.00

Visualization

Abstract

Java classes are very flexible, but this comes at a price. The main cost is that every class instance must be dynamically allocated. Their access by reference introduces pointer dereferences and complicates program analysis. These costs are particularly burdensome for small, ubiquitous data structures such as coordinates and state vectors. For such data structures a lightweight representation is desirable, allowing such data to be handled directly, similar to primitive types. A number of proposals introduce restricted or mutated variants of standard Java classes that could serve as lightweight representation, but the impact of these proposals has never been studied.Since we have implemented a Java compiler with lightweight data structures we are in a good position to do this evaluation. Our lightweight data structures are tuples. As we will show, their use can result in significant performance gains: for a number of existing benchmark programs using tuples we gain more than 50% in performance relative to our own compiler, and more than 20% relative to Sun's Hotspot 1.4 compiler. We expect similar performance gains for other implementations of lightweight data structures.With respect to the expressiveness of Java, lightweight variants of standard Java classes have little impact. In contrast, tuples add a different language construct that, as we will show, can lead to substantially more concise program code.