npalli
6 hours ago
Most likely explanation: In the Rust version, the compiler can see that expand_iota_views(&input).count() is a pure, loop-invariant expression since input never changes. It folds the whole computation and effectively turns the loop into "add the constant a thousand times". Make it do some work and it will line up to the C++ version.