Revisiting Loop Recognition in C++ in Rust
created: May 29, 2025, 11:18 p.m. | updated: June 2, 2025, 9:58 a.m.
The Algorithm (The It)The original paper uses an implementation of a loop recognition algorithm as a benchmark.
Idiomatic RustIf the goal is to write an idiomatic implementation of the algorithm in Rust, the place to start is Safe Rust.
push ( from ) ; } }Implementing in Safe RustHitting each of those bullet points really didn't describe how the Safe Rust implementation differs from the C++ or Unsafe Rust implementation.
I originally wanted to try to re-implement the original C++ using Modern C++ for comparison as well as a version similar in style to the Safe Rust version.
When moving to Unsafe Rust, the near identical implementation of the algorithm as the untuned C++ not only beat the C++ but the Safe Rust as well.
1 week, 3 days ago: Hacker News