4 ms·
How does Rust compare to Go in terms of performance? I know that Rust supposedly should be more secure at handling memory than Go. Does Rust have the same matur
by RapperWhoMadeIt 5y ago
How does Rust compare to Go in terms of performance? I know that Rust supposedly should be more secure at handling memory than Go. Does Rust have the same mature libraries that Go has? Building a RESTful API, or an HTTP(s) server or for that matter any kind of server (UDP/TCP) should be quite easy to do in Go, due to the awesome net standard packages (libraries) included with the language. Does the same apply to Rust, are the net packages of Rust mature enough?
I am just asking out of curiosity :)
- jeremychone 5y agoI am not a Go developer, I just looked at it from afar, but I understand that the GoRoutine was the cornerstone of high concurrency performance. In Rust, you have the async/await/future model. You can combine with MPSC (multiple producer single consumer) to have similar message-passing patterns or use traditional Mutex to access shared data. Although the async/await was not designed from the start, the Rust ecosystem has embraced this new concurrency model, which works very well. Tokio seems to be the major future executor crate available that most libraries gravitate around. So, at zero cost abstraction, all of that allows taking advantage of NIO OS capabilities fully, with extremely efficient async/await/future design choice and implementations (there are some good reading out there about the design decision). For example, I made a quick video on how to do a "blocking" Redis Stream Read over NIO, which shows concurrency with one thread. Rust to Redis with Async/Await - https://youtu.be/uD5hBVHwyDM https://youtu.be/uD5hBVHwyDM