Skip to content

Benchmarks: Dsl.scala vs Monix vs Cats Effect vs Scalaz Concurrent vs Scala Async vs Scala Continuation

杨博 (Yang Bo) edited this page May 8, 2018 · 26 revisions

We created some benchmarks to evaluate the computational performance of code generated by our compiler plug-in, especially, we are interesting how our !-notation and other direct style DSL affect the performance in an effect system that support both asynchronous and synchronous effects.

In spite of keywords of adapters to monads or other effect systems (see domain.cats and domain.scalaz), the preferred effect system for Dsl.scala is Task, the type alias of vanilla continuation-passing style function, defined as:

type !![Domain, Value] = (Value => Domain) => Domain
type TaskDomain = TailRec[Unit] !! Throwable
type Task[Value] = TaskDomain !! Value

Our benchmarks measured the performance of Task in Dsl.scala, along with other combination of effect system with direct style DSL, listed in the following table:

Effect System direct style DSL
Dsl.scala Task, an alias of vanilla continuation-passing style functions !-notation provided by Dsl.scala
Scala Future [Scala Async](https://github.com/scala/scala-async)
[Scala Continuation](https://github.com/scala/scala-continuations) library [Scala Continuation](https://github.com/scala/scala-continuations) compiler plug-in
[Monix tasks](https://monix.io/docs/2x/eval/task.html) for comprehension
[Cats effects](https://typelevel.org/cats-effect/datatypes/io.html) v comprehension
[Scalaz Concurrent](https://javadoc.io/page/org.scalaz/scalaz-concurrent_2.12/latest/scalaz/concurrent/Task.html) for comprehension
Clone this wiki locally