If Ruby has really slow performance how come Elixir is fast?

Strangly enough working with Ruby on my daytime job and Elixir whenever I can, I feel less and less that their syntaxes are similar, anyone else having the same kind of experience?

2 Likes

Depends on what exactly you mean by “syntax”; there’s a lot of similarity with low-level lexical stuff - for instance, string interpolation, hash rockets, do/end blocks. There’s enough parallelism that when things are explicitly not parallel like %{} vs {} for hash literals I still make errors by typing the Ruby version.

1 Like

Good point which makes me think.
I guess that at the beginning the emotional impact of syntax is look and feel and when you get used to that it is much more subtle.
I just see the big delta between a typical multiclause pattern matching def in Elixir and a def in Ruby now.
BTW that would also explain the massive Lisp rejection

Late to this party but the Elixir community culture resembles Ruby a lot, while Clojure and Erlang are much similar in this aspect.

Gah, zombie thread but…

I don’t think Ruby is slow compared to Elixir. In fact, I think most algorithmic exercises are faster in Ruby due to mutability…

But I think OOP is conducive of writing bad code, and that’s a big part of why we see all these blog posts about Elixir/Phoenix absolutely trouncing Ruby/Rails.

This is only true if we talk about single threaded code, I think that functional languages proved that immutability is a great performance improvement when we are talking about concurrent code reading from same pieces of memory, and while it doesn’t scale very good for huge systems, it is definitely a much more robust way to build distributed software.

1 Like

Ah yes, the persuasive college/school mate.

Technically though, I think Clojure is a good 5 years older right?

Edit: Whoops! Just realised that the comment I just replied to is over 3 years old.