Optimizing Communicating Event-Loop Languages with Truffle
The past few month, I have been busy implementing a fast actor language for the JVM. The language is essentially Newspeak with a smaller class library and without proving access to the underlying platform, which can lead to violations of the language’s guarantees.
My main focus for this project so far has been the actor model. Or more precisely, the communicating event-loop model à la E or AmbientTalk. The research goal is to show that the actor model can be made more practical for multicore programming, without breaking any of the actor guarantees such as deadlock-freedom and absence of low-level data races. We have been working on this already in the past, but so far performance was not a concern. This time around, performance is the main focus.
Coming Monday, I’ll give a presentation on first results at the AGERE!’15 workshop in Pittsburgh. The talk will focus on how we can bring some of the classic JIT compiler optimizations to asynchronous message sends, and how we can reduce the cost of isolation using Truffle.
Below are the abstract and link to the work-in-progress paper, or extended abstract if you will. However, since this was written already a few weeks ago, here another little update on the current state:
The plot shows the results of running the first few Savina benchmarks with a 4-core configuration for Scalaz as baseline, Akka, Jetlang, and SOMns. Scalaz seems to be the best performing actor framework at the moment. While SOMns is a little slower, it actually provides all the guarantees one would expect from an actor language. The JVM frameworks typically do not do that. So, I think, we are on a good way to make concurrent programming safe and fast.
Abstract
Communicating Event-Loop Languages similar to E and AmbientTalk are recently gaining more traction as a subset of actor languages. With the rise of JavaScript, E’s notion of vats and non-blocking communication based on promises entered the mainstream. For implementations, the combination of dynamic typing, asynchronous message sending, and promise resolution pose new optimization challenges.
This paper discusses these challenges and presents initial experiments for a Newspeak implementation based on the Truffle framework. Our implementation is on average 1.65x slower than Java on a set of 14 benchmarks. Initial optimizations improve the performance of asynchronous messages and reduce the cost of encapsulation on microbenchmarks by about 2x. Parallel actor benchmarks further show that the system scales based on the workload characteristics. Thus, we conclude that Truffle is a promising platform also for communicating event-loop languages.
- Optimizing Communicating Event-Loop Languages with Truffle; Stefan Marr, Hanspeter Mössenböck; Presentation at the AGERE!’15 Workshop, co-located with SPLASH’15.
- Paper: PDF, HTML
- BibTex: BibSonomy
Slides