JuliaCon 2020 (times are in UTC)

JuliaCon 2020 (times are in UTC)

Rocket.jl: A Julia package for reactive programming
2020-07-30 , Purple Track

Rocket.jl is a native Julia implementation of reactive programming concepts.
The package uses the observable sequence and actor model to make it easier to work with asynchronous data streams and message-driven program architectures.


The reactive programming (RP) paradigm is becoming increasingly popular. RP combines concepts from asynchronous data processing and the observer design pattern. Common applications are online data processing, interactive visualization and responsive user interfacing. The implementation of RP within a reactive framework allows developers to conveniently define relationships between data producers and consumers, and enables developers to build distributed and scalable applications more efficiently. Popular reactive frameworks in languages other than Julia include RxPy, RxJS, RxCpp and RxJava.

In areas such as machine learning, reinforcement learning and signal processing, data often arrive asynchronously and at different time scales. In this context, to reduce the developer's effort, RP offers a set of operators for composing, merging, filtering and transforming asynchronous data streams and provides a versatile API for listening for changes in these data streams.

In order to support RP in Julia, we have developed Rocket.jl, which is an efficient and flexible reactive extensions package, written in pure Julia.

Efficiency is achieved by relying on Julia's type system and advanced optimisation techniques. Rocket.jl introduces additional abstractions that can largely be evaluated and in-lined at compile time, resulting in an efficient implementation of RP with almost zero overhead compared to traditional imperative programs. Comparative performance benchmarks are available on the GitHub repository.

At the same time, flexibility is maintained by making use of Julia's multiple dispatch system. A user can readily extend built-in functionality with additional operators and custom observables. The self-contained documentation of Rocket.jl provides a convenient introduction to RP, and offers a collection of examples and use cases that illustrates how users can customize the built-in functionality to their needs.

We compared Rocket.jl with two other Julia implementations of the RP, and applied the basic map and filter operators to an asynchronous data stream. In terms of computation time, Rocket.jl outperforms Signals.jl and Reactive.jl on average by a factor of 2 and 4, respectively. Memory usage is similar across these packages.

We believe that usability is a key factor when applying the RP to practical problems. Therefore we designed Rocket.jl as a RP package that enables developers to build flexible and efficient reactive systems.

Dmitry Bagaev received his MSc degree in computational mathematics and computer science from Moscow State University in 2019. Currently he works as a PhD student in the BIASlab group (http://biaslab.org) at the electrical engineering department at Eindhoven University of Technology (TU/e).