Live data from Hacker News

Ask HN: Is Erlang an albatross to Elixir adoption?

news.ycombinator.com

91–100 of 109 posts

Re: Ask HN: Is Erlang an albatross to Elixir adoption?

#91

Earlier quoted context omitted.

`mix phx.new foo --no-live` does that. LiveView is completely optional. Node/npm has been completely replaced by esbuild and even that is optional if you want to rip it out and handle assets another way.

Yeah, I suppose that is why I thought it required JavaScript (the book instructed me to type --live). I was following the instructions of some books and there was JavaScript such as utils.js and whatnot. I typed what you told me, but it does have "foo/assets/vendor/topbar.js" and "foo/assets/js/app.js". Not sure what those are though or if they are a necessity. It ends up being "deps/phoenix_html/priv/static/phoenix_…

https://hexdocs.pm/phoenix/Mix.Tasks.Phx.New.html

I think you want the --no-assets option.

Re: Ask HN: Is Erlang an albatross to Elixir adoption?

#92

Earlier quoted context omitted.

> the 'number crunching' bits are offloaded to specialist languages because the underlying language model that Erlang uses does not lend itself for the kind of optimization that JS, Go, PHP etc have available to them simply because their runtime model is so completely different. Yeah I love Erlang, but often reach for something else when I need to be able to express and optimize compute bound problems.

In a way it makes perfect sense. When I look into my toolbox I see a whole pile of different saws, each of which has a specific usecase, metal, wood, living wood, trees, joinery, figure work, glass+ etc. The one-tool-to-fit-all-usecases programming language hasn't been invented yet as far as I can see. + technically, probably more of a grinder because the blade is covered with diamond dust, but you use it like a saw.

> The one-tool-to-fit-all-usecases programming language hasn't been invented yet as far as I can see.

Well, just like you can use a screwdriver to pound a nail into the wall (flip it handle-first), you could use C or Rust or Go or Java or...nearly anything to build...nearly anything if you really _forced_ it hard enough, had infinite time, expert labor and budget, but...

...there are better tools for the job of pounding a nail into the wall than a screwdriver! ;-)

In other words, I totally agree with you. Sure, you could build, oh I dunno, say a compute-intensive application entirely in, say, Ruby, but you'd need to throw some ungodly expensive hardware at it. Makes a lot more sense to use the right tool for the job!

Re: Ask HN: Is Erlang an albatross to Elixir adoption?

#93
post #38

Earlier quoted context omitted.

> It's a LISP designed for the JVM Honestly, this should be the Clojure tagline. Would solve a lot of the confusion. To be truthful, I never pictured it that way, but to be fair I think Clojure sells itself as more than that.

But it's more than that. It has different data structures, operators and semantics from Lisp - stuff which goes beyond just a simple retargeting to the JVM. It also provides an integration into/on top of the JVM, but also stuff like persistent functional data structures, avoids OOP, ... It's opinionated. Lisp and Scheme on the JVM exist, too.

I wish it would focus more on using technology provided by the underlying platform instead of its own half-baked and slow implementations. Clojure’s concurrency story is horrendous. There are multiple versions of shared memory concurrency on its JS and JVM runtimes but none of them scales to match the performance of the local APIs (Promises and Project Loom for Java). They are always playing catch-up five years after the original features have been shipped. Even today, trying to find an up to date library for features like WebWorkers or WebRTC that has seen a commit in the past year is a waste of time.

Re: Ask HN: Is Erlang an albatross to Elixir adoption?

#94
post #37
post #22

Raw performance is the actual albatross. IMHO, the low raw performance of Erlang is what's holding it back from mass adoption. (Even marquee Erlang/Elixir users like Discord, still have to use Rust NIFs to overcome the slow Erlang runtime) People have a hard time understanding how Erlang can have such: high concurrency, low latency & tight standard deviations ... when people are just accustom to looking at raw perfor…

> While BeamASM (JIT) is very exciting, the reality is that the Erlang runtime has only speed up by ~25% over the last decade Yes... because perf hasn't really been a focus for Erlang until about 1.5 years ago. Various (usually academic) third parties have contributed big performance-enhancing patchsets (the earlier JIT; Dialyzer and then HiPE based on Dialyzer analysis; etc.) but these have then languished, with att…

As an Elixir noob, I'm reading these comments about performance and coming to some conclusions that I'd like to ask ya'll to idiot-check me on.

First, let me establish that there are at least two ways of thinking about performance in the context of a server-side HTTP application:

1) Per-request speed ("from receiving the request to response, single-threaded, X ms") 2) Throughput-based metrics ("We can serve X requests per second with Y cores spread across Z nodes")

I think both ways of measurement have value, but in this context I'm operating under the assumption that we're focused on option 2. Correct me if I'm wrong.

Now, with that understanding in place, it sounds to me like Elixir/Erlang performs "pretty good" in terms of that overall throughput if you leverage the multithreading capabilities in building your apps and thread scheduling isn't terribly contentious (hopefully not a lot of other processes/threads competing for execution time on the same machine as your Elixir app), but measured on a raw per-operation speed metric it doesn't quite stack up to other non-compiled languages like PHP or maybe even Ruby (which would shock me but let's just poke that bear anyway, see what kinda growl we get...).

So if indeed my understanding is right, my next question is: "how much of a performance reduction would we realistically see with an Elixir app that's otherwise well built and doing the same thing?" Issues of misconfiguration, bad deployment architecture, etc. withstanding.

And if that question is indeed valid/not-batshit-crazy, my next would be: "does that degredation matter or scale in a multi-node/clustered deployment context?" In other words, if you have a say 50-node (be they VMs or containers) Elixir app, built well, properly configured and deployed, load balanced etc., is it going to have significantly/noticeably slower throughput than an equivalent PHP/Java/Ruby/$OTHERLANG app when compared as close to apples-to-apples as you can get that sort of thing?

(Maybe take Ruby out of the equation here with issues of GIL/threading being what they are over there. Haven't had the chance to work with recent Ruby though so if threading is a valid comparison nowadays, by all means keep it in mind!)

I'm just trying to get a sense for whether or not I'm barkin' up the wrong tree with my recent interest in Elixir. Am I wasting my time right now and maybe should wait a few years before really tearing into it, or is it effectively in a real-world, non-academic scenario, going to perform "close enough" in the real world in a multi-core, multi-node load balanced context?

Re: Ask HN: Is Erlang an albatross to Elixir adoption?

#95

My N00b take on Elixir in general (were N00B = Have my first app, an MQTT/API bridge written and deployed running on Ubuntu employing Bandit, Finch, Tortoise, OpenAPISpex, and Jason). The immediate answer would be no. I would say 5%-15% of my questions asked on the Slack channel have ended up in Erlang land. The first time someone answered with "you want :binary.bin_to_list()", I was completely confused. "What is :bi…

This is fantastic feedback. I always love reading posts like yours. Three quick notes to complement what you said: * The formatter is always a balancing act. The behaviour you see is because people get really upset when we don't respect their line breaks (and, as you correctly said, we can't later know which newlines were introduced by us). You can try formatting more frequently to get feedback sooner (that's what I…

People like José are why I like the Elixir community. So many others would have taken offense and become defensive.

Re: Ask HN: Is Erlang an albatross to Elixir adoption?

#96
Chiming in with 6 years of professional Erlang experience. I'm somewhat familiar with Elixir, having worked on some Elixir codebases for a few months.

> The notion that to learn a language you also need to learn a second one is not great. [...] It's just bizarre.

I disagree. I don't think it's bizarre. I expect to sometimes have to poke around in C code when writing Erlang or Python. It's also fairly common for C/C++ developers to look at the assembly output of some piece of code using https://godbolt.org/.

> Reading the code is NOT an answer.

Again, I disagree, and I think this perspective is harmful to career development. Knowing how things work on a deep(er) level is a superpower. When you're writing Elixir, do you never open up a .ex file in the standard library to see how something is implemented? Are you not at all interested in what powers things like Phoenix.PubSub?

> I don't know what a solution is, but perhaps a concerted effort to create a documentation and library ecosystem that never links back to Erlang would help.

I suspect that a library ecosystem that doesn't require Erlang would be a huge effort to implement and test, and would wind up pulling in all of the ideas from Erlang that you haven't learned/mastered yet. A better alternative would be to accept the fact that Elixir builds on top of Erlang, and understand that a deeper knowledge of Erlang is going to help you improve as an Elixir developer.

> And where there are critical systems that use an Erlang library, perhaps rebuilding it in Elixir is in order?

I'm definitely biased, but I would be much less trusting of an Elixir copy of a 'critical' Erlang library. Many of the selling points of Elixir that lead to very concise code (read: macros, 'using', and others) are things that make it difficult for me to develop a deep understanding of a library. It's cool to use DSLs like Ecto and Plug, but I have a much harder time understanding those libraries as a result. Erlang's unambiguous syntax and its basic text-substitution-based macro system are much easier for me to understand, and while it takes more effort to write APIs and code that are as concise as what's available in Elixir, I know that I can open up an Erlang file and trust that much less is hidden from me.

Re: Ask HN: Is Erlang an albatross to Elixir adoption?

#97

My N00b take on Elixir in general (were N00B = Have my first app, an MQTT/API bridge written and deployed running on Ubuntu employing Bandit, Finch, Tortoise, OpenAPISpex, and Jason). The immediate answer would be no. I would say 5%-15% of my questions asked on the Slack channel have ended up in Erlang land. The first time someone answered with "you want :binary.bin_to_list()", I was completely confused. "What is :bi…

This is fantastic feedback. I always love reading posts like yours. Three quick notes to complement what you said: * The formatter is always a balancing act. The behaviour you see is because people get really upset when we don't respect their line breaks (and, as you correctly said, we can't later know which newlines were introduced by us). You can try formatting more frequently to get feedback sooner (that's what I…

+1 to the struct thing and very interested in your thoughts! I've personally taken to using protobufs instead with the excellent https://github.com/elixir-protobuf/protobuf library. They work beautifully but are obviously a lot more heavy weight. It would be nice to have more ergonomic native structs.

Re: Ask HN: Is Erlang an albatross to Elixir adoption?

#99
post #79
post #41

Earlier quoted context omitted.

Devil's advocate: What would it take to programmatically port/transpile the core of Erlang's ecosystem to Elixir? Pick the killer app to serve as the root node (Phoenix?) and walk back to the leaves (OTP, popular libraries, etc). Do a 1-time cutover of literally everything. Fork/port ERTS (incl BEAM) to make Elixir-native and rebrand it. Etc. While I generally agree that "rewriting as bad" there is something to be sa…

I had this same thought because I think Elixir and Erlang are actually similar enough that translating between them directly may be feasible and have decent results. I don’t really think forking is a good idea though. As I understand it most BEAM maintenance is actually done by Ericsson, and I’m not sure the Elixir community has the resources to sustain a project like that. It seems like it would also create bad bloo…

As someone coming from erlang (but not a huge ton of experience in it) my only gripe is the difference in string/binary handling, everything else is quite smooth, totally comparable to Clojure+Java libs.

Re: Ask HN: Is Erlang an albatross to Elixir adoption?

#100
post #34

Earlier quoted context omitted.

IIRC they don't, but as someone who doesn't know Erlang, the Erlang documentation was really hard to read and the APIs differed from other Elixir libraries.

+100 — the heart of the problem

Imagine it's an important lib you can't just replace and there's a bug you need fixed and can't just wait for the maintainer to do it for you. Now you suddenly need to understand that language enough to do that. To some extent this happens very often, I've had it in Clojure+Java and PHP+C libraries.
Post reply on HN