Needs advice
on
ElixirElixirPythonPython
and
RustRust

which is great for web development? Elixir with Pheonix or Python with Django? or Rust with Rocket? which stack provides low latency, almost real-time, quick data updates? and also does not put a burden on CPUs for Cloud Software Development?

READ LESS
6 upvotes·74.7K views
Replies (2)

Summary Statically-typed, compiled languages will deliver better performance than their competitors. Golang and Rust are excellent options. Golang will be slightly more latent but has excellent concurrency, built-in garbage collection, and was designed by Google high throughput with minimal blocking time. Rust will be more performant and will use fewer CPU cycles and memory per unit time. Still, your development time will be longer than Golang, especially if you're coming from a dynamically typed language. If you chose Rust, Rocket is a good option (Nickel is another one you can check out for high performance); if you chose Golang, FastHTTP is highly performant.

If you're looking for near real-time performance with minimal CPU utilization: statically typed, compiled languages deliver the most optimizations. Their compilers can best optimize the executable because they know which data type to expect for every variable instantiated. If you're coming from a dynamically typed language, Golang features real-time garbage collection, concurrency, and dynamic-like variable assignment. Rust does not have garbage collection and relies on a program's developer(s) to clean up after themselves. Not having garbage collection in a language leads to highly performant code, however, as the programmer determines when garbage is collected and memory deallocated or reassigned.

For a look at Rust vs. Golang vs. Python's execution times, you can look at these two pages: Golang vs. Python Benchmarks and Golang vs. Rust Benchmarks. On average, you will see Rust is faster than Golang is faster than Python. Rust and Golang are close to each other in performance terms (compared to Python especially), but Rust uses less memory and CPU cycles per unit time.

If concurrency or high throughput is more important than latency, use Golang. Golang has a built-in concurrency mechanism that is amazing at yielding high throughput and eliminating, or controlling, when a subroutine blocks the rest of the main routine. Golang also supports defining structs in a way similar to classes, allowing you to access the function like a Python class method (using the dot . operator). Golang also allows for dynamic variable type assignment using the walrus := operator within a function, easing the switch from a dynamically typed language to a statically typed one. Golang's built-in garbage collector and concurrency methods, dynamic variable assignment via the walrus operator, method-like function calling will minimize your development time between Golang and Rust if you're coming from a dynamically typed language.

We all know that when performance matters, though, it really matters. Rust does not have a garbage collector, allowing code executions with the smallest latency. The rust compiler is very helpful and has been known to catch most possible runtime errors helping to prevent your code from throwing an error and stopping execution. Rust will deliver faster performance over Golang.

READ MORE
Rust vs Go — Bitfield Consulting (bitfieldconsulting.com)
4 upvotes·441 views
Recommends
on
Elixir
Rust

Great for web dev? All are pretty great, but my experience with Elixir is pretty limited, less so with Rust but still, it's not my day-to-day language, so take my words with a grain of salt.

Performance-wise, Rust is unbeatable if you are aiming for low latency and CPU bounded tasks as well. For data updates, that really depends on how good the database connector or ORM is. It may vary a lot in real-world scenarios but in TechEmpower benchmark at least, a Rust framework + Diesel ORM is the best of the three. However, if you are talking about very high and spiky traffic, a queueing system is almost 100% required. Your normal RMDBS will not handle that well. But then again, I don't think performance should be your first priority when you start your project.

Python w/ Django is super mature and great for productivity but performance isn't this combo's strength. With the recent and upcoming work on async, I believe it will get much better but still, Python as a language is the slowest of the three. Check out FastAPI, Starlette, or other async frameworks + uvicorn for better performance. I like FastAPI and Blacksheep the best, with good performance and a beyond great typing story, which is a strong booster for productivity.

For Rust, check out Warp, Axum, and Actix-Web as well. I like Axum and Actix quite a bit better as I am not a great fan of macros. Also, Axum comes from the tokio-rs team, so I think (hope) it will receive sustained active development.

READ MORE
3 upvotes·1 comment·494 views
Manuel Rubio
Manuel Rubio
·
October 18th 2021 at 12:24PM

In my opinion, because I'm not a current developer of Rust (yet) but I was for Python and Django and I'm at this moment for Elixir and Phoenix, the point of Elixir and Phoenix is to get easy the scalability of your system, and for sure, whatever you build on top of it, should be easier to scale than others. While Python is a system that helps you with fast development and putting your project fast for time-to-market, it's easier to get more people which are good developers on that language, Elixir is helping you in the same way and even it's prepared to grow with you without hassle. Rust I'm pretty sure that could be more performant and if you need to do something which isn't scalable or should be staying compulsory in only one machine, it's the best choice. Otherwise, go with Elixir and Phoenix, no regrets I can ensure it :-)

·
Reply
Avatar of newlifejames4234