Skip to content

Tutorial ~ Introduction

Vlad Ureche edited this page May 8, 2015 · 22 revisions

The ildl plugin for Scala allows programmers to define custom transformations for their code. This is especially interesting for library developers, who can distribute optimizing transformations along with the library artifacts, making them readily available to programmers. In turn, the transformations allow the compiler to optimize the data encoding, storage and operations, resulting in faster executions and a lower memory footprint. On our benchmarks, ildl transformations induced speedups between 1.8x and 13x.

The transformation mechanism provided by the ildl plugin is very versatile and can accommodate a wide range of use cases:

Defining a transformation is as simple as defining a Scala object:

/** 
 *  Encodes pairs of integers as long integers, saving
 *  as much as 64 - 8 = 56 bytes for each pair on the
 *  standard Oracle Java Virtual Machine version 7.
 */
object IntPairAsLong extends TransformationDescription {
  def toRepr(pair: (Int, Int)): Long = ...
  def toHigh(long: Long): (Int, Int) = ...
}

And applying it is even simpler:

adrt(IntPairAsLong) {
  class MyClass extends ... {
    // all values of type (Int, Int) in
    // this class are represented as Long
  }
}

The ildl transformations have a series of desirable properties:

  • maintaining object inheritance (and overriding), even in the presence of data transformations;
  • automatically encoding and decoding values when passing them from/to code that has not been transformed;
  • transformed scopes interoperate with encoded data, even if they lie in different files and are separately compiled;
  • unlike macros, transformations can be defined in the same compilation run as the transformed program;
  • transformations work across separate compilation and can be distributed as Scala objects.

From here:

  • if you want to see an example and learn more about the motivation behind ildl, see the >> Motivation section of the tutorial
  • if you want to see the transformation in action, see the >> Transformation section of the tutorial
  • or get back to the [[>> home page|Home]].
Frog Work Ahead: Some of the pages of this wiki are in flux. If you can't find what you are looking for, please [file a bug](https://github.com/miniboxing/ildl-plugin/issues).

Clone this wiki locally