this post was submitted on 08 Sep 2023
18 points (95.0% liked)
Rust Lang
148 readers
1 users here now
Rules [Developing]
Observe our code of conduct
- Strive to treat others with respect, patience, kindness, and empathy.
- We observe the Rust Project Code of Conduct.
- Submissions must be on-topic
- Posts must reference Rust or relate to things using Rust. For content that does not, use a text post to explain its relevance.
- Post titles should include useful context.
- For Rust questions, use the stickied Q&A thread. [TBD]
- Arts-and-crafts posts are permitted on weekends.
- No meta posts; message the mods instead.
Constructive criticism only
- Criticism is encouraged, though it must be constructive, useful and actionable.
- If criticizing a project on GitHub, you may not link directly to the project’s issue tracker. Please create a read-only mirror and link that instead.
- Keep things in perspective
- A programming language is rarely worth getting worked up over.
- No zealotry or fanaticism.
- Be charitable in intent. Err on the side of giving others the benefit of the doubt.
No endless relitigation
- Avoid re-treading topics that have been long-settled or utterly exhausted.
- Avoid bikeshedding.
- This is not an official Rust forum, and cannot fulfill feature requests. Use the official venues for that.
No low-effort content
- Showing off your new projects is fine
No memes or image macros
- Please find other communities to post memes
No NSFW Content
- There are many other NSFW communities, let’s keep this related to the language
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
I disagree. Async Rust is fine, but it does have some baggage, not least of which is Pin/Unpin which I still don't fully understand. But that aside, I prefer writing async Rust to any other language because the rest of Rust comes along for the ride!
It's actually amazing that I can use the same mental model for async code on a small MCU or a large server.
Is Arc really the worst GC? Doesn't Swift use reference counting also? I did a few minutes of searching but couldn't really find any benchmarks comparing Arc with Swift RC or some other GC.
I feel that async Rust is a good set of tradeoffs that allows it to scale to a lot more than just writing web servers. Rust seems to be pretty good for web servers too though.
ARC can memory leak if you don’t properly use weak references when appropriate. You trade GC ticks for having to deal with a counter. generally GC will (raw language performance aside) have higher throughput (because its not spending time doing ref counts) but will have more sporadic latency because if the GC ticks, then your program is basically on pause until it’s done.
Comparing them as if one is better than the other feels like painfully missing the point. Completely different memory models. And if you’re only slightly making use of ARC, then switching to a GC is a big jump.
I guess that's my point. The article criticizes reference counting as if it's strictly worse, but it's not so simple. Even with a GC funny things can happen so it's worth understanding the memory model of the language.