Bit weird to have a rust tutorial list JavaScript async as assumed knowledge tbh.
Who Runs Your Rust Future? Hands-On Intro to Async Rust
21–30 of 40 posts
Re: Who Runs Your Rust Future? Hands-On Intro to Async Rust
#22Re: Who Runs Your Rust Future? Hands-On Intro to Async Rust
#23Bit weird to have a rust tutorial list JavaScript async as assumed knowledge tbh.
Yeah, it also makes it seem like Rust is weird for using Future as the type name, but actually JavaScript (Promise) is the odd one out here. Probably a JS dev learning Rust without much exposure to other languages
Re: Who Runs Your Rust Future? Hands-On Intro to Async Rust
#24Bit weird to have a rust tutorial list JavaScript async as assumed knowledge tbh.
Re: Who Runs Your Rust Future? Hands-On Intro to Async Rust
#25Earlier quoted context omitted.
You use async to preserve system resources. For example you can easily exhaust the host with ~20k connections running a thread-per-connection schema where each thread simply waits for epoll event, async prevents this by having a threadpool of ~16 threads that handle all the connections instead of polling the scheduler wakes it up, asks "do you haev work to do" if not continues to next task. (This heavily varied by th…
> You use async to preserve system resources. For example you can easily exhaust the host with ~20k connections running a thread-per-connection schema... Sure, if you need to run 20k connections then use async. But the fact of the matter is that the vast majority of software is not going to take on 20k connections. Those people (i.e the majority of software devs) should use threads, because they are much easier to re…
Re: Who Runs Your Rust Future? Hands-On Intro to Async Rust
#26Ok, what is going on in the comments here? I get people liking the article but this many comments just to say they liked it is very un-HN to me. Smells like bots to me.
Re: Who Runs Your Rust Future? Hands-On Intro to Async Rust
#27Re: Who Runs Your Rust Future? Hands-On Intro to Async Rust
#28Async ruined rust and I’ll stand by that until I die
Re: Who Runs Your Rust Future? Hands-On Intro to Async Rust
#29Don't use async but use threads instead. Threading treats the CPU as a resource, which it is! Whereas async simply locks the CPU, which can deplete the system for longer computations. If you hate garbage collection pauses (which most Rust users do) then don't use async.
You can mix and match. For work, I run a conferencing server ... packet processing runs in one thread per core, out of band signalling runs in async on a separate pool of threads. It used to all be async, but using threads for packet processing shaved a little cpu, doing my own timers shaved a little cpu, cpu pinning the threads and the sockets shaved a little cpu, and at the end of the day we shaved a couple instanc…
I don’t think I ever seem this patterns, What I’ve seen is either a thread pool for tasks (what essentially async is), or dedicated threads for each parts of the processing (a thread for the UI, and a thread for some background services like playing music).