cloudflare / boringtun

Userspace WireGuard® Implementation in Rust
BSD 3-Clause "New" or "Revised" License
5.92k stars 397 forks source link

Question about rust lang #337

Closed mmhdi closed 1 year ago

mmhdi commented 1 year ago

Hi, I am building a platform, but I do not know which language is better in terms of browsing performance and speed. What do you think, should I use Rust, Go, or C?

Noah-Kennedy commented 1 year ago

I'm closing this since this isn't really related to boringtun, but I'll give you a short answer here.

Rust is generally going to be your best bet if all that you are interested in is performance. Rust's particular async/await design and the tokio runtime allow you to write Rust code that is very hard to match in terms of server-side performance in any other language. For stuff which isn't asynchronous, Rust performs as well as C while being substantially easier to work with and verify soundness with. Go is much slower here.

Depending on what you are doing however, speed may be more a factor of your architecture and component design than language. I'd recommend asking further questions on the Rust language community discord or the Rust language forums.