It depends just how fast you need it. C++ is much easier to get to zero abstraction code.

In Rust you are constantly fighting the stdlib and other libraries, and you have to litter your hot code with unsafe blocks to get it to stop adding a branch to nearly every object access, be it for bounds checks or over/underflow checks.

C++ does a much better job at giving you a zero abstraction API, and you can always drop down to raw pointers if you want, without(!!!!) unsafe blocks and weird tricks. Of course it's unsafe in C++ but the friction to writing a branchless hot loop is muuuuch smaller.

When profiling and optimizing Rust code, I very often find myself poring over the generated code, making small changes, reading api docs, and trying again, much more than in C++. Lots of unsafe Rust APIs are not even nearly good enough, even with most checks turned off you will find branches that just branch to panic!(), which is, you guessed it, still more code and a branch than the code would suggest.

I get why people think that most systems languages are the same "speed", but they really are not if you are hitting limits of the hardware in your hot loops.

> over/underflow checks.

Integer overflows are not checked in release builds by default, since they are not related to memory safety.

On the other hand, rust emits noalias everywhere, which helps in autovectorization.

Yep. And array bounds checks have a miniscule performance impact at runtime because they're so friendly to branch prediction.

How is not having to mark your unsafe code as unsafe a good thing?

You couldn't have come up with something more incomprehensible.

If 99% of your code doesn't use unsafe, why contaminate 100% of your code base with footguns?

I agree with your point, but for completeness:

> How is not having to mark your unsafe code as unsafe a good thing?

The problem with unsafe code in Rust is that IIRC nobody actually figured out yet the "rules" of unsafe i.e. which invariants you can stretch and which can cause UB. My (not super up to date) understanding is that this is an active area of research and progress is being made and also that in practice there are many well understood usages.

In short unsafe rust is somewhat worse than C++ as the boundaries of UB are less well understood/defined