ABSTRACT
Java Virtual Machines are optimized for performing well on traditional Java benchmarks, which consist almost exclusively of code generated by the Java source compiler (javac). Code generated by compilers for other languages has not received nearly as much attention, which results in performance problems for those languages.
One important specimen of "another language" is Scala, whose syntax and features encourage a programming style that differs significantly from traditional Java code. It suffers from the same problem -- its code patterns are not optimized as well as the ones originating from Java code. JVM developers need to be aware of the differences between Java and Scala code, so that both types of code can be executed with optimal performance.
This paper presents a detailed investigation of the performance impact of a large number of optimizations on the Scala DaCapo and the Java DaCapo benchmark suites. It describes the optimization techniques and analyzes the differences between traditional Java applications and Scala applications. The results help compiler engineers in understanding the characteristics of Scala.
We performed these experiments on the work-in-progress Graal compiler. Graal is a new dynamic compiler for the HotSpot VM which aims to work well for a diverse set of workloads, including languages other than Java.
- S. M. Blackburn, R. Garner, C. Hoffman, A. M. Khan, K. S. McKinley, R. Bentzur, A. Diwan, D. Feinberg, D. Frampton, S. Z. Guyer, M. Hirzel, A. Hosking, M. Jump, H. Lee, J. E. B. Moss, A. Phansalkar, D. Stefanović, T. VanDrunen, D. von Dincklage, and B. Wiedermann. The DaCapo benchmarks: Java benchmarking development and analysis. In Proceedings of the ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages, and Applications, pages 169--190. ACM Press, Oct. 2006. doi: 10.1145/1167473.1167488. Google ScholarDigital Library
- G. Duboscq, L. Stadler, T. Würthinger, D. Simon, and C. Wimmer. Graal IR: An extensible declarative intermediate representation. In Proceedings of the Asia-Pacific Programming Languages and Compilers Workshop, 2013.Google Scholar
- R. Hickey. The Clojure programming language. In Proceedings of the 2008 symposium on Dynamic languages. ACM Press, 2008. Google ScholarDigital Library
- U. Hölzle, C. Chambers, and D. Ungar. Debugging optimized code with dynamic deoptimization. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 32--43. ACM Press, 1992. ISBN 0-89791-475-9. doi: 10.1145/143095.143114. Google ScholarDigital Library
- K. Hoste and L. Eeckhout. Cole: compiler optimization level exploration. In Proceedings of the International Symposium on Code Generation and Optimization, pages 165--174. ACM Press, 2008. doi: 10.1145/1356058.1356080. Google ScholarDigital Library
- M. R. Jantz and P. A. Kulkarni. Performance potential of optimization phase selection during dynamic JIT compilation. In Proceedings of the ACM/USENIX International Conference on Virtual Execution Environments, pages 131--142. ACM Press, 2013. doi: 10.1145/2451512.2451539. Google ScholarDigital Library
- S. Kulkarni, J. Cavazos, C. Wimmer, and D. Simon. Automatic construction of inlining heuristics using machine learning. In Proceedings of the International Symposium on Code Generation and Optimization. IEEE Computer Society, 2013. doi: 10.1109/CGO.2013. 6495004. Google ScholarDigital Library
- T. Lindholm, F. Yellin, G. Bracha, and A. Buckley. The Java#8482; Virtual Machine Specification, Java SE 7 Edition. Addison-Wesley, 2013. Google ScholarDigital Library
- M. Odersky and al. An overview of the scala programming language. Technical Report IC/2004/64, EPFL Lausanne, Switzerland, 2004.Google Scholar
- OpenJDK Project. Graal Project. URL http://openjdk.java.net/projects/graal/.Google Scholar
- R. Pozo and B. Miller. SciMark 2.0. URL http://www.spec.org/jbb2005/.Google Scholar
- A. Sewe, M. Mezini, A. Sarimbekov, and W. Binder. Da Capo con Scala: design and analysis of a scala benchmark suite for the java virtual machine. In Proceedings of the ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages, and Applications, pages 657--676. ACM Press, 2011. Google ScholarDigital Library
- A. Sewe, M. Mezini, A. Sarimbekov, D. Ansaloni, W. Binder, N. Ricci, and S. Z. Guyer. new Scala() instance of Java: a comparison of the memory behaviour of Java and Scala programs. In Proceedings of the International Symposium on Memory Management, pages 97--108. ACM Press, 2012. doi: 10.1145/2258996.2259010. Google ScholarDigital Library
- L. Stadler, G. Duboscq, H. Mössenböck, and T. Würthinger. Compilation queuing and graph caching for dynamic compilers. In Proceedings of the ACM workshop on Virtual Machines and Intermediate Languages, pages 49--58. ACM Press, 2012. doi: 10.1145/2414740.2414750. Google ScholarDigital Library
- Standard Performance Evaluation Corporation. SPECjbb2005,. URL http://www.spec.org/jbb2005/.Google Scholar
- Standard Performance Evaluation Corporation. SPECjvm2008,. URL http://www.spec.org/jvm2008/.Google Scholar
Index Terms
- An experimental study of the influence of dynamic compiler optimizations on Scala performance
Recommendations
Applying Optimizations for Dynamically-typed Languages to Java
ManLang 2017: Proceedings of the 14th International Conference on Managed Languages and RuntimesWhile Java is a statically-typed language, some of its features make it behave like a dynamically-typed language at run time. This includes Java's boxing of primitive values as well as generics, which rely on type erasure.
This paper investigates how ...
Da capo con scala: design and analysis of a scala benchmark suite for the java virtual machine
OOPSLA '11: Proceedings of the 2011 ACM international conference on Object oriented programming systems languages and applicationsOriginally conceived as the target platform for Java alone, the Java Virtual Machine (JVM) has since been targeted by other languages, one of which is Scala. This trend, however, is not yet reflected by the benchmark suites commonly used in JVM ...
Design of the Java HotSpot™ client compiler for Java 6
Version 6 of Sun Microsystems' Java HotSpot™ VM ships with a redesigned version of the client just-in-time compiler that includes several research results of the last years. The client compiler is at the heart of the VM configuration used by default for ...
Comments