Hacker News new | ask | show | jobs
by alfiedotwtf 484 days ago
To me, the point of using a Rust version over a C version of anything would be for memory safety not performance, so a 1:1 rewrite doesn’t make any sense ie. because what’s the point - you’ve now reproduced any memory dangers!
1 comments

It’s never either or nor does a 1:1 rewrite imply the use of unsafe or reproduced memory dangers. For example, vec[v.len()] has no memory safety issues so even if the C code did that in rust it would just panic. Similarly, the bounds checks can often end up being elided by converting to idiomatic rust with iterators and for loops. While the point for you may not be performance, the reason many systems engineers are excited about Rust replacing c/C++ is precisely because it shows promise in memory safety with equivalent or better performance which makes it an and rather than or proposition