top | item 43792999

(no title)

inglor | 10 months ago

> Unlike Node.js, Rust's Tokio allows us to spawn a new Task and run futures within it.

Nice article! For future reference in Node.js this would be `worker_threads` or if you want a higher level tokio like API something like https://piscinajs.dev/

This has been possible in Node.js for quite a while

--

Also for blocking I/O CPU bound parallelism I've found Rayon to be a pleasure. It has a few caveats but it leverages the Rust race condition checking well and it's very ergonomic.

I happily mix it with `tokio` in an application that is CPU bound but has to perform some async I/O (due to the SDKs it uses)

discuss

order

remram|10 months ago

A tokio task is not a thread

inglor|10 months ago

A node worker_thread is not a thread either though :]

SkiFire13|10 months ago

> piscinajs

Lmao this wordplay made my day

> Rust race condition checking

Nit: Rust does not prevent race conditions, it prevents data races.