News for hackers. Stuff that matters.
Re:Elixir vs. Erlang: a question of momentum by josai on Thursday April 23, 2015 @11:24AM (#9427329)
>> I feel like people are really overstating the momentum Elixir has

I don't think so at all. I see elixir gaining a groundswell of momentum very much like the early days of rails and node. Of course it's the beginning, but I see a whole different crowd of people interested in elixir - the "gets things done" crowd rather than the "this is cool/elite" crowd I see playing with factor or haskell (sorry, but it's true).

Elixir does not compete with Python, Ruby or JS - it solves a whole different problem, which is the "massively multiplayer" requirement the apps world is obviously moving towards. No-one I know likes Go or Scala. Clojure is a genuine competitor, you are right about that, but it lacks the ruby community spirit showing itself in elixir. Say what you want about ruby but its community moves mountains.

It's early, yes, but I know a lot of good rails devs who are embracing elixir and they're all "smart and gets things done" types. A lot of torque is building behind taking elixir mainstream, and there's excitement in the air. Time will tell, but it's a bet I'm increasingly ready to make.

Re:Elixir vs. Erlang: a question of momentum by lighthawk on Thursday April 23, 2015 @11:30AM (#9427371)
> Elixir does not compete with ... Ruby ...

I think it does, actually, though not intentionally. José Valim was a Rails core dev and as far I can tell he took on Elixir to address concerns with performance.

In http://elixir-lang.org/blog/2013/08/08/elixir-design-goals/ he says, "Given my previous background in Ruby, it is natural that some of the constructs added were borrowed from Ruby. However, those additions were a by-product, never a language goal." He follows this with a comparison of Ruby code to Elixir.

I'm heavy into Ruby but looking forward to Elixir gaining strength.

Re:Elixir vs. Erlang: a question of momentum by josai on Thursday April 23, 2015 @11:51AM (#9427531)
> I think it does, actually

You may be right, but what I meant is that every rubyist i know looking into elixir is after massively persistent connections. Websocket, basically, to thousands or more clients. They are leaving ruby because it simply cannot offer that (I don't care what DHH says. No-one big is doing EM WS in production, nor should they).

Phoenix has a steeper learning curve than rails but is addressing the new paradigm of persistent duplex connections. Rails remains unapologetically a request-based framework, ActionCable notwithstanding. That is fine. 99% of today's apps don't that. Right tool for the job! But to me, the future is very clear.

I'm heavy into ruby too, but speaking pragmatically, it and elixir are playing different games in different ballparks. That's why I said they don't compete.

Re:Elixir vs. Erlang: a question of momentum by lectrick on Thursday April 23, 2015 @01:28PM (#9428318)
There are many, many other selling points to Elixir/Erlang over Ruby, if you already like Ruby (and its syntax, some of its conventions, etc.)

1) Immutable data throughout- prevents certain classes of bugs

2) 10x faster- obvious benefit

3) Actual macros- the ultimate metaprogramming: http://elixir-lang.org/getting-started/meta/macros.html

4) Functional paradigm- encourages decoupling of code by forcing state to be passed around explicitly as arguments, this also aids unit testing, it also reduces bugs further

5) Instant "forking" without having to worry about thread safety, and good semantics around it

6) Potential 99.999999999% uptime reliability (thanks to Erlang's OTP)

7) Hot-swappable code upgrades with no downtime

8) Pattern-matching reduces the amount of "switch logic" code greatly. In Ruby code I often saw complex logic branches with no test coverage- it's easier to cover those in Elixir when every "branch" is a different pattern-matched function

9) A bunch of neato things such as build-your-own-sigils, which felt even more "Ruby-like" than Ruby's own capability (or lack thereof) here: http://elixir-lang.org/getting-started/sigils.html

10) Trendy Actor model built-in from the get-go ;)

Re:Elixir vs. Erlang: a question of momentum by lighthawk on Thursday April 23, 2015 @02:56PM (#9428985)
> A bunch of neato things such as build-your-own-sigils, which felt even more "Ruby-like" than Ruby's own capability

I like custom sigils, those are pretty cool, e.g. def sigil_i(string, []), do: String.to_integer(string)

But, having to put that char into the method name rather than argument, doesn't that limit the characters that you can use? Seems like would be better as arg.

Re:Elixir vs. Erlang: a question of momentum by lectrick on Sunday April 26, 2015 @07:19PM (#9443677)
I agree with that... Perhaps it's limited that way on purpose?
Re:Elixir vs. Erlang: a question of momentum by pbowyer on Thursday April 23, 2015 @03:38PM (#9429288)
> 2) 10x faster- obvious benefit

Given Erlang is sometimes slower than Python [1] I am surprised if it's 10x speed improvement over Ruby.

1: https://news.ycombinator.com/item?id=9417453 (start at last comment & work up)

Re:Elixir vs. Erlang: a question of momentum by TylerE on Thursday April 23, 2015 @04:31PM (#9429596)
It depends on what you're doing.

I believe for the sort of thing typically done in these sort of languages (which usually boil down to doing lots of string processing) Elixir may well be 10x faster.

The reason?

Lack of dynamism.

Function calls in python/ruby? SLOOOOOW

Function calls in Elixir? Hella fast, because it's all resolved at compile time, there's no dynamic lookup, no creating a locals dictionary for each call, etc.

(PS: Most typical web frameworks make a LOT of function calls - all that data sanitizing, templating, and formatting has to happen somewhere)

It's true that Elixir is slower if doing numerics heavy code since it can't just call out to a highly tweaked numeric library like NumPy.

(This is all talking single threaded, of course. With a parrallizeable task you won't even be in the same zip code.)

Re:Elixir vs. Erlang: a question of momentum by bascule on Thursday April 23, 2015 @10:40PM (#9431139)
Erlang and Elixir are both dynamically typed and do dynamic dispatch.

Erlang does not know the types flowing through a call site in advance and therefore has to do dynamic dispatch.

In particular, Erlang has a "code server" that all calls throughout the system must thunk through, versus a statically typed language where a call is optimized to a single JMP instruction. Smarter JITs, like Java's HotSpot, can also do this, and HotSpot is smart enough to inline both virtual and dynamic dispatch at runtime. BEAM can't.

Erlang's closest thing to a JIT (HiPE) cannot inline calls across modules, has no support for deoptimization, and is in effect a naive, crappy, AOT compiler which does the bare minimum to work in an otherwise dynamic environment.

Source: I made this... it was basically Elixir before Elixir:

http://reia-lang.org/

These days I like languages that can actually avoid this overhead through the use of static typing, like Rust.

Note that it isn't necessarily bad that Erlang works this way. When it comes to Erlang's core strength: coordinating the concurrent activities of a massive number of processes/clients, it really does shine. Just don't use it for anything CPU-intensive.

Re:Elixir vs. Erlang: a question of momentum by drieddust on Thursday April 23, 2015 @05:21PM (#9429905)
6) Potential 99.999999999% uptime reliability (thanks to Erlang's OTP)

I don't have much understanding of programming language internals but why we don't thing see low level stuff like distributed file system written in Erlang.

I genuinely interested in knowing why this is not tried by someone?

Re:Elixir vs. Erlang: a question of momentum by TylerE on Thursday April 23, 2015 @05:40PM (#9430052)
Every phone call you've made in the last 10 years+ probably touched an erlang node at some point. That's pretty distributed.

If your're looking for more traditional server stuff, there's RabbitMQ.

Re:Elixir vs. Erlang: a question of momentum by KirinDave on Thursday April 23, 2015 @07:56PM (#9430673)
Actually quite a few systems have been! Besdies telco stuff, Facebook used it quite a bit and I'm told it was in LinkedIn's stack as well.

I get a lot of recruiting interest from my time at Powerset as an erlang engineer, from the most surprising places. Game companies come up a lot.

Re:Elixir vs. Erlang: a question of momentum by bascule on Thursday April 23, 2015 @10:38PM (#9431134)
> 10x faster- obvious benefit

Please put down the kool aid. If you can't back statements like this up, you're not helping anyone.

Re:Elixir vs. Erlang: a question of momentum by lectrick on Thursday April 23, 2015 @11:02PM (#9431193)
I would swear I saw this somewhere, but in the meantime, this shows up to 6x

http://benchmarksgame.alioth.debian.org/u64q/compare.php?lan...

Re:Elixir vs. Erlang: a question of momentum by lectrick on Friday April 24, 2015 @02:19AM (#9431701)
Re:Elixir vs. Erlang: a question of momentum by karmajunkie on Thursday April 23, 2015 @01:36PM (#9428365)
Add one to the column of people who are into Elixir for reasons that have nothing to do with websockets.
Re:Elixir vs. Erlang: a question of momentum by sjtgraham on Thursday April 23, 2015 @12:40PM (#9427955)
> No-one big is doing EM WS in production

Are you kidding me? Look at Pusher, which is literally EM sitting behind Route 53

Re:Elixir vs. Erlang: a question of momentum by bsummer4 on Thursday April 23, 2015 @02:20PM (#9428723)
Pusher? Aren't they moving all of their code to Haskell?
Re:Elixir vs. Erlang: a question of momentum by mdpye on Friday April 24, 2015 @05:03AM (#9432116)
It will be a long time before we're rid of EventMachine. It's served (relatively) well considering, but I wouldn't say any of us are fans or would recommend it for new projects.
Re:Elixir vs. Erlang: a question of momentum by themartorana on Thursday April 23, 2015 @12:15PM (#9427707)
Hi. I'm Dave. I really like Go, and I write and maintain a real-time and turn-based multiplayer game backend.

I liked Elixir a lot too, but when trying to pick the right tool, the learning required around Elixir/Erlang, the VM, and OTP didn't make sense when writing a production system that needs to handle 1000 req/s or more with a small staff. Go handles what we do fantastically.

Now you know someone. :)

Re:Elixir vs. Erlang: a question of momentum by rdtsc on Thursday April 23, 2015 @01:22PM (#9428286)
Actually OTP makes even more sense though. WhatsApp processes billions of messages per day and they only have 10 or so engineers working on the backend.

At any large scale what becomes more important is fault tolerance. Even though Go has goroutines and sane and modern concurrent IO handling, goroutines still share memory. So then even a super fast 1M req/s system is no good if it is down 50% of the time because it crashed.

Re:Elixir vs. Erlang: a question of momentum by perishabledave on Thursday April 23, 2015 @03:27PM (#9429213)
If your interested, Jamie Winsor of Undead Labs did a talk at Erlang Factory on how they use Elixir for their backend: https://www.youtube.com/watch?v=_i6n-eWiVn4

Also theres a good writeup on how Erlang was used for some of Call of Duty's infrastructure. http://www.erlang-factory.com/upload/presentations/395/Erlan...

Sounds like you're already committed to Go, but just wanted to make the case. Concurrent, fault-tolerant, highly scalable systems is Elixir's sweet spot.

[edit] One more, great talk from the Elixir Conf on how Martin Shurrer used Erlang to build a multiplayer card game. This one is particularly good because it deals with scaling, game states, and is very practical: http://confreaks.tv/videos/elixirconf2014-otp-in-production-...

Re:Elixir vs. Erlang: a question of momentum by themartorana on Thursday April 23, 2015 @09:49PM (#9431003)
To be clear, I really liked both Elixir and Erlang. It's just that purely functional programming, the Erlang VM, OTP, and so on all required learning, and so introduced so many possible points of failure.

Go was familiar from the jump, and easy to reason around coming from primarily Objective-C, C, Python, and C#. Considering timeline, it wouldn't have made sense to be so behind the learning curve.

With more time or breathing room, I think Erlang would be a space I'd jump into with both feet.

Edit: I know Martin through common colleagues and have worked with him in Austria. He's a great dev, and that was a good watch. Thanks for the link.