Abstract
To maximize run-time performance, programmers often specialize their code by hand, replacing library collections and containers by custom objects in which data is restructured for efficient access. However, changing the data representation is a tedious and error-prone process that makes it hard to test, maintain and evolve the source code. We present an automated and composable mechanism that allows programmers to safely change the data representation in delimited scopes containing anything from expressions to entire class definitions. To achieve this, programmers define a transformation and our mechanism automatically and transparently applies it during compilation, eliminating the need to manually change the source code. Our technique leverages the type system in order to offer correctness guarantees on the transformation and its interaction with object-oriented language features, such as dynamic dispatch, inheritance and generics. We have embedded this technique in a Scala compiler plugin and used it in four very different transformations, ranging from improving the data layout and encoding, to retrofitting specialization and value class status, and all the way to collection deforestation. On our benchmarks, the technique obtained speedups between 1.8x and 24.5x.
Supplemental Material
Available for Download
This is the paper artifact. It is a ZIP archive with the following hash: md5sum ee0bfb76ce7e3ab063e5fa3364bfd964 sha1sum dd413118cc6c7846ba8c2e1563ce777d6b411050 Inside, you will find the following files: * README.txt <= just to satisfy the requirements * README.pdf <= the actual Getting Started guide * iLDL-VM-64-v1.0.tar.gz <= the artifact virtual machine Hope you find it useful!
- Scala Streams Repository. URL https://web.archive.org/ web/20150719095701/https://github.com/biboudis/ scala-streams.Google Scholar
- Gaussian integers wikipedia article. URL https://web.archive. org/web/20150627074634/https://en.wikipedia.org/wiki/ Gaussian_integer.Google Scholar
- ILDL Scala Compiler Plugin Source Code (also available in the artifact attached to the paper),. URL https://web.archive.org/ web/20150719095959/https://github.com/miniboxing/ ildl-plugin.Google Scholar
- ILDL Scala Compiler Plugin Documentation (also available in the artifact attached to the paper),. URL https://web.archive.org/ web/20150719095927/https://github.com/miniboxing/ ildl-plugin/wiki.Google Scholar
- LDL-based Staging Scala Compiler Plugin. URL https://web.archive. org/web/20150719095846/https://github.com/miniboxing/ staging-plugin.Google Scholar
- The Miniboxing plugin website. URL https://web.archive.org/web/ 20141218011004/http://scala-miniboxing.org/.Google Scholar
- Rosetta Code Website. URL https://web.archive.org/web/ 20090106202220/http://rosettacode.org/.Google Scholar
- ScalaBlitz Optimizer. URL https://web.archive.org/web/ 20141218200210/http://scala-blitz.github.io/.Google Scholar
- Scala SIP-15: Value Classes. URL http://docs.scala-lang.org/ sips/completed/value-classes.html.Google Scholar
- Sparkle Tool. URL https://web.archive.org/web/ 20150719095739/https://github.com/mighdoll/sparkle.Google Scholar
- Optimistic Respecialization Attempts 1-5,. URL https://web.archive. org/web/20150719095636/http://io.pellucid.com/blog/ optimistic-respecialization.Google Scholar
- Optimistic Respecialization Attempt 6,. URL https://web.archive. org/web/20150719095603/http://io.pellucid.com/blog/ optimistic-respecialization-attempt-6.Google Scholar
- P. Aleksandar, D. Petrashko, and M. Odersky. Efficient Lock-Free Work-stealing Iterators for Data-Parallel Collections. In PDP ’15. IEEE, 2015.Google Scholar
- A. Biboudis, N. Palladinos, and Y. Smaragdakis. Clash of the Lambdas. ICOOLPS, 2014.Google Scholar
- A. Biboudis, N. Palladinos, G. Fourtounis, and Y. Smaragdakis. Streams a la carte: Extensible Pipelines with Object Algebras. In ECOOP ’15. ACM, 2015.Google Scholar
- C. F. Bolz, A. Cuni, M. Fijalkowski, and A. Rigo. Tracing the meta-level: PyPy’s tracing JIT compiler. In ICOOLPS, Genova, Italy, 2009. ACM. Google Scholar
Digital Library
- C. F. Bolz, L. Diekmann, and L. Tratt. Storage Strategies for Collections in Dynamically Typed Languages. In OOPSLA, OOPSLA ’13. ACM, 2013. Google Scholar
Digital Library
- K. J. Brown, A. K. Sujeeth, H. J. Lee, T. Rompf, H. Chafi, M. Odersky, and K. Olukotun. A heterogeneous parallel framework for domain-specific languages. In PACT. IEEE Computer Society, 2011. Google Scholar
Digital Library
- E. Burmako. Scala Macros: Let Our Powers Combine!: On How Rich Syntax and Static Types Work with Metaprogramming. In SCALA. ACM, 2013. Google Scholar
Digital Library
- A. Deutsch. On Determining Lifetime and Aliasing of Dynamically Allocated Data in Higher-order Functional Specifications. In POPL. ACM, 1990.. Google Scholar
Digital Library
- I. Dragos. Compiling Scala for Performance. PhD thesis, École Polytechnique Fédérale de Lausanne, 2010.Google Scholar
- I. Dragos and M. Odersky. Compiling Generics Through User-Directed Type Specialization. In ICOOOLPS, Genova, Italy, 2009. Google Scholar
Digital Library
- A. Gal. Trace-based Just-in-time Type Specialization for Dynamic Languages. In PLDI. ACM, 2009. Google Scholar
Digital Library
- C. F. Gauss. Theoria residuorum biquadraticorum, volume 1. Apud Dieterich, 1828.Google Scholar
- A. Genêt, V. Ureche, and M. Odersky. Improving the Performance of Scala Collections with Miniboxing (EPFL-REPORT-200245). Technical report, EPFL, 2014. URL http://scala-miniboxing.org/.Google Scholar
- A. Georges, D. Buytaert, and L. Eeckhout. Statistically Rigorous Java Performance Evaluation. In Proceedings of the 22nd annual ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages and Applications, OOPSLA ’07, 2007. Google Scholar
Digital Library
- B. Goetz. State of the Specialization, 2014. URL https://web.archive. org/web/20150102143158/http://cr.openjdk.java.net/ ~briangoetz/valhalla/specialization.html.Google Scholar
- R. Harper and G. Morrisett. Compiling Polymorphism Using Intensional Type Analysis. In PoPL. ACM, 1995. Google Scholar
Digital Library
- S. L. P. Jones and J. Launchbury. Unboxed Values as First Class Citizens in a Non-Strict Functional Language. In Functional Programming Languages and Computer Architecture. Springer, 1991. Google Scholar
Digital Library
- V. Jovanovic, V. Nikolaev, N. D. Pham, V. Ureche, S. Stucki, C. Koch, and M. Odersky. Yin-Yang: Transparent Deep Embedding of DSLs. Technical report, EPFL, 2013.Google Scholar
- B. W. Lampson and H. E. Sturgis. Reflections on an Operating System Design. Commun. ACM, 1976. ISSN 0001-0782. Google Scholar
Digital Library
- X. Leroy. Unboxed Objects and Polymorphic Typing. In PoPL. ACM, 1992. Google Scholar
Digital Library
- H. Miller, P. Haller, E. Burmako, and M. Odersky. Instant Pickles: Generating Object-oriented Pickler Combinators for Fast and Extensible Serialization. In OOPSLA. ACM, 2013. Google Scholar
Digital Library
- R. Morrison, A. Dearle, R. C. H. Connor, and A. L. Brown. An Ad Hoc Approach to the Implementation of Polymorphism. ACM TOPLAS, 1991. Google Scholar
Digital Library
- B. C. Oliveira, T. Schrijvers, W. Choi, W. Lee, and K. Yi. The Implicit Calculus: A New Foundation for Generic Programming. In PLDI. ACM, 2012. Google Scholar
Digital Library
- A. Prokopec. ScalaMeter. URL http://axel22.github.com/ scalameter/.Google Scholar
- T. Rompf and M. Odersky. Lightweight Modular Staging: A Pragmatic Approach to Runtime Code Generation and Compiled DSLs. In GPCE, 2010.. Google Scholar
Digital Library
- J. Rose. Value Types and Struct Tearing,. URL https://web. archive.org/web/20150530182530/https://blogs.oracle. com/jrose/entry/value_types_and_struct_tearing.Google Scholar
- J. Rose. Value Types in the VM,. URL https://web.archive.org/ web/20150525232233/https://blogs.oracle.com/jrose/ entry/value_types_in_the_vm.Google Scholar
- Z. Shao. Flexible Representation Analysis. In ICFP. ACM, 1997. Google Scholar
Digital Library
- L. Stadler, T. Würthinger, and H. Mössenböck. Partial Escape Analysis and Scalar Replacement for Java. In CGO. ACM, 2014. Google Scholar
Digital Library
- W. Taha. A Gentle Introduction to Multi-stage Programming. In Domain-Specific Program Generation, pages 30–50. Springer, 2004.Google Scholar
- D. Tarditi, G. Morrisett, P. Cheng, C. Stone, R. Harper, and P. Lee. TIL: A Type-Directed Optimizing Compiler for ML. In PLDI. ACM, 1996. Google Scholar
Digital Library
- P. J. Thiemann. Unboxed Values and Polymorphic Typing Revisited. In Functional Programming Languages and Computer Architecture. ACM, 1995. Google Scholar
Digital Library
- V. Ureche. Additional Material for "Unifying Data Representation Transformations (EPFL-REPORT-200246)". Technical report, EPFL, 2014.Google Scholar
- V. Ureche, C. Talau, and M. Odersky. Miniboxing: Improving the Speed to Code Size Tradeoff in Parametric Polymorphism Translations. In OOPSLA, 2013. Google Scholar
Digital Library
- V. Ureche, E. Burmako, and M. Odersky. Late Data Layout: Unifying Data Representation Transformations. In OOPSLA ’14. ACM, 2014. Google Scholar
Digital Library
- V. Ureche, M. Stojanovic, R. Beguet, N. Stucki, and M. Odersky. Improving the Interoperation between Generics Translations. In PPPJ. ACM, 2015. Google Scholar
Digital Library
- P. Wadler. Views: A Way for Pattern Matching to Cohabit with Data Abstraction. In PoPL. ACM, 1987. Google Scholar
Digital Library
- P. Wadler. Deforestation: Transforming Programs to Eliminate Trees. In ESOP ’88. North-Holland Publishing Co., 1988. Google Scholar
Digital Library
- P. Wadler and S. Blott. How to Make Ad-hoc Polymorphism Less Ad hoc. In PoPL. ACM, 1989. Google Scholar
Digital Library
- T. Würthinger, C. Wimmer, A. Wöß, L. Stadler, G. Duboscq, C. Humer, G. Richards, D. Simon, and M. Wolczko. One VM to Rule Them All. In Onward! ACM, 2013. Google Scholar
Digital Library
- G. Xu. CoCo: Sound and Adaptive Replacement of Java Collections. In ECOOP. Springer-Verlag, 2013. Google Scholar
Digital Library
Index Terms
Automating ad hoc data representation transformations
Recommendations
Automating ad hoc data representation transformations
OOPSLA 2015: Proceedings of the 2015 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and ApplicationsTo maximize run-time performance, programmers often specialize their code by hand, replacing library collections and containers by custom objects in which data is restructured for efficient access. However, changing the data representation is a tedious ...
Improving the Interoperation between Generics Translations
PPPJ '15: Proceedings of the Principles and Practices of Programming on The Java PlatformGenerics on the Java platform are compiled using the erasure transformation, which only supports by-reference values. This causes slowdowns when generics operate on primitive types, such as integers, as they have to be transformed into reference-based ...
Bridging islands of specialized code using macros and reified types
SCALA '13: Proceedings of the 4th Workshop on ScalaParametric polymorphism in Scala suffers from the usual drawback of erasure on the Java Virtual Machine: primitive values are boxed, leading to indirect access, wasteful use of heap memory and lack of cache locality. For performance-critical parts of ...






Comments