Export to
Tuesday, October 21, 2014 at 1:10pm.
PDXScala Monthly Meeting
Website
Description
Hey folks! It’s time again for our monthly meeting. Whether you’re a newcomer to Scala or an experienced expert, we’d love to have you join us. This month we have very lucky timing overlapping with OOPSLA, which means we'll have some special guests joining us for our meeting. Two of these guests will be giving talks: Tiark Rompf and Vald Ureche.
Tiark Rompf graduated EPFL in the Scala team, where he developed the Lightweight Modular Staging framework (LMS), which compiles domain-specific programs to efficient and parallel code for GPUs, multi-threaded CPUs and clusters. Currently Tiark is a professor at Purdue University and he just got the best paper award in the most prestigious conference in databases, VLDB, for a paper applying the Lightweight Modular Staging technique for databases queries. Tiark will be discussing LMS.
Vlad Ureche is a PhD student in the Scala Lab at EPFL, where he's working on optimizing high-level patterns in the Scala programming language down to fast JVM bytecode. His main project, miniboxing (scala-miniboxing.org), is aimed at compiling generic classes down to very efficient bytecode. Vlad also contributed to the Scala compiler in the areas of specialization, the JVM backend and on the scaladoc tool, where you may have seen the diagrams and the implicit member listings he developed.
Vlad's talk is titled Miniboxing: JVM Generics without the overhead. The following abstract provides an overview of this talk:
Generics are now a must-have in any statically typed programming language. Yet, there is a strong tension between the uniform interface exposed to programmers and the low level implementation, which has to deal with data of different sizes and semantics: booleans, integers, floating-point numbers and heap objects. Different languages have taken in very different paths to implementing generics, each with its own advantages and drawbacks. In Java and other JVM languages the standard is boxing primitive values, meaning that heap objects are used to carry primitive values. This leads to significant slowdowns and increased heap consumption, especially when using generic collections for primitive types.
Scala proposes specialization as an alternative to boxing: the compiler can duplicate and adapt user code for each primitive type, thus using unboxed data. Specialization has been shown to reliably speed up code and is extensively used in established community libraries, such as spire (non/spire) and breeze (scalanlp.org). But statically duplicating code can result in significant jar sizes and long compilation times. For example, specializing a 3-element tuple, which takes three type parameters, yields 1000 almost-identical classes.
In the miniboxing project we set out to reduce the static bytecode size while maintaining optimality: we build on the idea of tagged union, thus offering a single variant of the code for all primitive value types. This means the 3-element tuple can now be specialized with just 8 classes. But matching the performance of specialization was a long and convoluted journey. In this presentation I will explain the basics of miniboxing and show what we had to do to match the speed of specialized code.
The project's website, scala-miniboxing.org, contains all you need to get started: the miniboxing compiler plugin, documentation, usage examples and benchmarks.