Skip to content

Instantly share code, notes, and snippets.

Created June 10, 2016 21:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maxvt/ca19af8a68b789f7f6fffd6c263d6d2f to your computer and use it in GitHub Desktop.
Save maxvt/ca19af8a68b789f7f6fffd6c263d6d2f to your computer and use it in GitHub Desktop.
Notes on _Scala and Elixir_ - a talk by Jeff Alexander at Erlang&Elixir SF MeetUp (8-Jun-2016)

Notes on Scala and Elixir - a talk by Jeff Alexander at Erlang&Elixir SF MeetUp (8-Jun-2016)

Jeff uses mostly Scala at work, trying out Elixir mostly for personal education.

Both languages are VM based. Scala: everything is a function. Elixir: everything is an expression. Both have tail recursion and pattern matching.

Let's look at performance:

2015 dimroc ETL showdown - 2x advantage to Scala; Elixir folks jumped in to do some improvements and get better results than Scala, but doing optimizations that made the code quite different from the original so the comparison might be unfair. Scala community did not offer any further improvement.

Techempower benchmark of HTTP servers -

Functional programming example: streams, well supported by both. Strict evaluation? Erlang - always. Scala - has lazy Val's (immutable, as opposed to mutable vars)

By default: scala passes immutable things by value; can choose to reference. Same for Erlang.

Type safety: scala infers types at compilation time and complains if it can't. Elixir: not available by default, but type specs are available.

Message passing: scala using akka; elixir: built in. Both use futures. Akka benchmark: comparable with Elixir performance (1m actors)

Big data: Elixir has no good numerical computation libraries, no ML Parallel computing: Spark Elixir: large single tasks don't fit the language model.

Access to Java libraries from Scala is great. Many ways to write stuff in Scala - Twitter style guide. Golang is opposite - compiler enforces style.

Release management: sbt in scala Release functionality of OTP is used for Elixir but historically has been very poorly documented.

Akka has supervisory actors, same as Erlang.

Conclusion: Rewriting things in Elixir has costs - sometimes Scala is appropriate. Without proper numerical and ML support Elixir will not be appropriate for many big data tasks; even though bindings to other languages (C++) can be written, so far no one has done so.

Proponents of Elixir express an order-of-magnitude improvement in performance but it is not really borne out by many comparisons/benchmarks.

Scala is a good language has a lot of functional stuff people love.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment