Live data from Hacker News

Benchmarking Phoenix vs. Rails vs. Sinatra vs. Express vs. Martini

github.com

11–20 of 34 posts

Re: Benchmarking Phoenix vs. Rails vs. Sinatra vs. Express vs. Martini

#11

Is elixir just a different syntax for erlang, or are the semantic differences? Their website doesn't seem to make it very clear.

Elixir is to Erlang what Scala is to Java. They leverage the Erlang VM in the same way that Scala leverages the JVM.

Re: Benchmarking Phoenix vs. Rails vs. Sinatra vs. Express vs. Martini

#12

Is elixir just a different syntax for erlang, or are the semantic differences? Their website doesn't seem to make it very clear.

Elixir makes a lot of the syntax of Erlang (derived from Prolog) simpler and more familiar to people working from, say, a Ruby background.

It adds better support for UTF8, better metaprogramming tools for declaring custom constructs, a standard library for things like collections and streams, proper default setup for some use of OTP patterns, and various other things. It adds a few sane default conventions for things like documentation, testing, and private/public visibility in modules.

It in turn transpiles to Erlang, so has all the same performance characteristics.

Re: Benchmarking Phoenix vs. Rails vs. Sinatra vs. Express vs. Martini

#13
Elixir is Erlang with some Ruby-like syntactical sugar that vanishes when you look very close at it but makes the transition very easy. It's not like moving to Erlang or Haskell or OCaml coming from procedural languages.

I have experience with Sinatra and Rails and I did a small project with Elixir and Phoenix in September. My bet before looking at the benchmarks was Phoenix >> Sinatra > Ruby, and that's the way it turned out to be. I was curious about how Martini and Node would compare.

That said, I enjoyed developing with Phoenix and it's really similar to Rails in its structure. The differences are about having views+templates (decorator pattern) instead of Rails' plain views (which would be Phoenix's templates) and having first class handlers for websockets. The developers of Phoenix answered quickly to all my questions and to the issues I opened on GitHub (it's still 0.x software in heavy development).

Anyway I still can't use it to replace Rails in the projects I do for my customers. There many reasons for that, some about Phoenix and some about me.

1) There aren't enough developers and it won't be wise for a customer to become too dependent from me (or any other developer)

2) There isn't an ecosystem comparable to the Rails one yet. Example: it can take forever to develop a replacement for all the basic functionality a Rails developer gets for free from a gem like devise (everything that revolves around authentication).

3) There might be many useful tools from the Erlang world but it takes time to learn them and become decently productive with Erlang and Elixir. How to make decent money while going back so many years productivity-wise? Obviously this applies to any transition to any ecosystem.

4) Performances usually don't matter at all: most servers have to sustain only low loads and Rails is good enough for that. In 20 years I probably had to work with only two web applications were speed really mattered. One was done with Java, the other one was PHP+Java and it was constrained more by the db than by the frontend. However I would consider Elixir right now for any heavily concurrent server, let's say a game server with thousands of players.

Re: Benchmarking Phoenix vs. Rails vs. Sinatra vs. Express vs. Martini

#14

Is elixir just a different syntax for erlang, or are the semantic differences? Their website doesn't seem to make it very clear.

They are pretty much the same. This is what Erlang's creator wrote about Elixir 1.5 years ago http://joearms.github.io/2013/05/31/a-week-with-elixir.html

tl;dr there are good innovations and bad things, not a surprise :-)

Re: Benchmarking Phoenix vs. Rails vs. Sinatra vs. Express vs. Martini

#15

Martini is slow, try again with Negroni which is the new lib by the author of Martini.

Aren't they quite different creatures, though? It's clear that language is not the only determining factor, since Sinatra is so much faster than Rails, and the Node example is so much faster in a cluster configuration. If the experience of programming for Sinatra, Phoenix, and Martini are very similar, it's fair to compare them (though maybe benchmarks may not be super useful, given that the database layer is likely to be the bottleneck in most large site deployments rather than simple routing and other stuff being compared here). If Negroni is very different (I don't know that it is, but a brief perusal of the site for Martini and the github for Negroni indicates very different experiences) then it's possibly no more useful a comparison than Rails to Phoenix.

Re: Benchmarking Phoenix vs. Rails vs. Sinatra vs. Express vs. Martini

#16

Is elixir just a different syntax for erlang, or are the semantic differences? Their website doesn't seem to make it very clear.

Elixir makes a lot of the syntax of Erlang (derived from Prolog) simpler and more familiar to people working from, say, a Ruby background. It adds better support for UTF8, better metaprogramming tools for declaring custom constructs, a standard library for things like collections and streams, proper default setup for some use of OTP patterns, and various other things. It adds a few sane default conventions for things…

Is it therefore possible to use Erlang libraries in an Elixir application, or to "drop to Erlang" in places where it could be advantageous?

Re: Benchmarking Phoenix vs. Rails vs. Sinatra vs. Express vs. Martini

#17

Is elixir just a different syntax for erlang, or are the semantic differences? Their website doesn't seem to make it very clear.

I don't have any experience with it, but your question reminded of this article[0] that came up on HN a while ago arguing it's more than just syntax differences. Basically that it's more a Clojure/Scala than a Coffeescript.

[0] http://devintorr.es/blog/2013/06/11/elixir-its-not-about-syn...

Re: Benchmarking Phoenix vs. Rails vs. Sinatra vs. Express vs. Martini

#18

Earlier quoted context omitted.

Elixir makes a lot of the syntax of Erlang (derived from Prolog) simpler and more familiar to people working from, say, a Ruby background. It adds better support for UTF8, better metaprogramming tools for declaring custom constructs, a standard library for things like collections and streams, proper default setup for some use of OTP patterns, and various other things. It adds a few sane default conventions for things…

Is it therefore possible to use Erlang libraries in an Elixir application, or to "drop to Erlang" in places where it could be advantageous?

Erlang and Elixir can call each other with no overhead.
Post reply on HN