Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.)



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.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: