Papillon6814

Papillon6814

When to use elixir, when to use Rust?

I’m new to Elixir, and like to use Rust.
When do you use Elixir, and when do you use Rust?

Most Liked

kokolegorille

kokolegorille

There is a showcase of using Rust with the BEAM in this post…

Main reason is immutability can be slow when dealing with large collection…

They wrote a mutable sorted set in Rust as Nif, available here.

https://github.com/discordapp/sorted_set_nif

dimitarvp

dimitarvp

If you have extremely performance-sensitive code, adding Rust to an Elixir project might be worth it.

Be warned though: many people regularly underestimate Elixir’s (and thus Erlang’s) speed. They are quite fast and even when they aren’t, you have some options to hand-craft certain pieces of code that can give you a big performance boost.

Don’t try to just use Rust inside an Elixir project before you have factually checked that you absolutely positively need more performance.

praveenperera

praveenperera

I also love both languages.

If you mean what types of projects to use for each language here’s what I find myself doing:

  • For web servers and projects dealing with databases you just can’t beat elixir, Phoenix and ecto (in my opinion). So I always reach for elixir for these types of projects.

  • For CLIs and little utility programs I find myself using Rust. It’s fun to use, you can become pretty productive in it, it’s super fast and it’s really easy to create and distribute binaries for basically every operating system.

To give you an idea, here is a simple CLI I made in rust: GitHub - avencera/rustywind: CLI for organizing Tailwind CSS classes · GitHub

I was able to distribute it quite easily using NPM

Where Next?

Popular in Discussions Top

New
AlexMcConnell
The reason that Rails is as popular as it is is because it’s very easy for relatively inexperienced developers to get a lot of work done....
588 20046 166
New
sergio
There’s a new TIOBE index report that came out that shows Elixir is still not in the top 50 used languages. It also goes on to call Elix...
New
jer
I’ve been using umbrellas for a while, and generally started off (on greenfield projects at least) by isolating subapps based on clearly ...
New
pdgonzalez872
If this has been asked here before, please point me to where it was asked as I didn’t find it when I searched the forum. Maybe a mailing ...
New
AstonJ
If so I (and hopefully others!) might have some tips for you :slight_smile: But first, please say which area you’re finding most challen...
New
cvkmohan
The upcoming Phoenix 1.6 release looks very interesting. Became a habit to watch the commits - and - what they are bringing in. phx.gen...
New

Other popular topics Top

KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 36654 110
New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 54921 245
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New

We're in Beta

About us Mission Statement