Per Gustafsson      

Picture of Per

I am a member of the High Performance Erlang (HiPE) group at the department of Information Technology at Uppsala University. We work to improve the performance and usability of the concurrent functional language Erlang.

In the group we work on several different projects.

My research

I work on improving support for manipulating bit streams in Erlang. Since Erlang's most important application domain is telecommunications programming many programs deal with communication based on bitstreams.  To simplify these tasks a pattern matching syntax was developed.

My first project was to show how our native code compiler could implement this efficiently without producing to much code through selective translation. This is described in [5]. This paper did not deal with any high level aspects, but it only showed how a particular set of virtual machine instructions could be translated into a register transfer language.

To make this low level pattern matching efficient it is important to perform high level optimizations as well. In [3] and more extensively in [1] we describe how  pattern matching compilation could be adjusted to be used to compile pattern matching on bit streams. We devised one tree based method to get maximal performance as well as a guarded sequential automaton based method to minimize code size.

Unfortunatly the syntax for pattern matching in Erlang suffer from some issues, in particular the binary datatype was based on a byte stream. This creates a lot of extra work for the users of this construct when they deal with bit streams forcing them to manually calculate how to pad their bit streams in order to store it in a byte stream. In [2] we present a proposal on how to extend the syntax to avoid this issue as well as some other problems. In addition we introduce the notion of binary comprehensions similar to list comprehensions.

In [6] we describe how a true bit stream data structure can be implemented in Erlang and how that makes many applications a lot simpler to write. In addition to this we compare the result of this approach with other languages both in terms of performance and in terms of conciseness. The  benchmarks that we use in this paper is available from  this webpage.

In [7] we describe a formal semantics for pattern matching on bit streams in the context of a small functional language. This paper also include most of the work from [6] as this is an earlier longer version of that paper


[1] Efficient manipulation of binary data using pattern matching
  with Konstantinos Sagonas
  in the  Journal of Functional Programming 16(1), pages 35–74, January 2006.

[2] Bit-Level Binaries and Generalized Comprehensions in Erlang
  with Konstantinos Sagonas
  in the Erlang Workshop (ERLANG 05).

[3] Adaptive Pattern Matching on Binary Data
  with Konstantinos Sagonas
  in the European Symposium on Programming (ESOP 2004).

[4] All You Wanted to Know About the HIPE Compiler (and might have been afraid to ask)  
  with K. Sagonas, M. Pettersson, R. Carlsson and T. Lindahl
  in the Erlang Workshop (ERLANG 03).

[5] Native Code Compilation of Erlang's Bit Syntax
  with Konstantinos Sagonas
  in the Erlang Workshop (ERLANG 02).
[6] Applications, Implementation and Performance Evaluation of Bit Stream Programming in Erlang
  with Konstantinos Sagonas
accepted for PADL'07


[7] Functional Manipulation of Bit Streams
  with Konstantinos Sagonas