this post was submitted on 15 Jun 2023
13 points (93.3% liked)
Programming
17373 readers
292 users here now
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Rules
- Follow the programming.dev instance rules
- Keep content related to programming in some way
- If you're posting long videos try to add in some form of tldr for those who don't want to watch videos
Wormhole
Follow the wormhole through a path of communities [email protected]
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
One benefit of using rust for webservers in general is that it's possible to have a consistently lower latency compared to GCd langues: discord mentions this in their article about migrating to rust from go: https://discord.com/blog/why-discord-is-switching-from-go-to-rust
Another difference between rust and e.g. python is that rust expects you to invest more time to get code that's runnable in the first place, but likely more well optimized and correct.
In my experience from writing rust, the language pushes you to write more efficient code compared to python because it makes things like copying visible and also because it's easier to reason about memory usage compared to garbage collection which means that you're more likely to have a useful model of the performance cost of various things while you're programming.
It's possible that a hypothetical lemmy written in python would have allowed the devs to do some big picture optimizations that they haven't had the time to do yet in the rust version, so for the time being it might be slower than a python alternative.
Rust is likely to catch up though: eventually the rust version will probably also have this optimization while the python version has to resort to make smaller optimizations that the rust version already had in the first version of the code or that you get for free from the language.
I would like to point out that this article from Discord could be considered outdated these days. This comparison is using a old version of Go, that in recent years got a optimization on the GC and now would have much lower spikes than those showed in the article
Still, Rust surely will give you a higher performance and lower latency than Python