Optimization of Strings

Projects > Compiler and JVM Research at JKU

We implemented an optimization that fuses the string object with its character array that holds the actual content. New bytecodes access the characters and allocate the strings. Nevertheless, the optimization is implemented completely inside the VM. The necessary bytecode rewriting is performed by the class loader. Optimized string objects are significantly smaller than the old string and its character array. This eliminates field loads, reduces the memory pressure, and the time necessary for garbage collection. It is a research project, but could show up in a future product version because it has a high impact on the performance.


  • Christian Häubl, Christian Wimmer, Hanspeter Mössenböck:
    Compact and Efficient Strings for Java
    Science of Computer Programming, volume 75, issue 11, pages 1077-1094. Elsevier, 2010. doi:10.1016/j.scico.2010.04.010
    Journal paper that describes the optimization in detail and evaluates it when applied to the client and the server compiler.
  • Christian Häubl, Christian Wimmer, Hanspeter Mössenböck:
    Optimized Strings for the Java HotSpot™ Virtual Machine
    6th Intl. Conf. on Principles and Practice of Programming in Java (PPPJ'08), pp. 105-114. ACM Press, 2008. doi:10.1145/1411732.1411747
    Conference paper that covers the most important parts of the implementation and shows performance results for the client compiler.
  • Christian Häubl:
    Optimized Strings for the Java HotSpot™ Virtual Machine
    Master's thesis, Institute for System Software, Johannes Kepler University Linz, 2008.
    This thesis describes the complete architecture and implementation of the optimization for the client compiler, together with a comprehensive evaluation.