upvote
Yep. Also:

The rust borrow checker makes it difficult to implement tree like structures with pointers like you would in C or C++. Safe rust trees are (imo) best written using vecs.

Rust makes function arguments noalias.

Rust adds runtime array bound checks.

Rust and C++ do iteration quite differently. Rust encourages map/filter/reduce. I suspect this results in different assembly.

Doing a “unity build” in rust is really easy (codegen-units=1). In C++, you need to make heavy modifications to your build system and sometimes your source too.

But with some time you could probably port the optimisations across. If anyone has some spare tokens, Claude can be quite good at doing this sort of work. Show it both repositories and tell it to make the C++ code just as fast as rust.

reply