How can we improve the rust-specific optimization?

I would like to do some experiments to explore the performance impact of the MIR optimization algorithm on the compilation of Rust programs, and analyze how the MIR optimized algorithm can be further improved.

I used rustc-perf as benchmark, and I run the projects with different optimization combinations. The results show that the optimization at the LLVM level is significant, while the optimization at the MIR level seems to be unstable.

I think there is definitely space for improvement in MIR-based optimization algorithms, such as improvement or addition of some specific algorithms, but how should I further specify exactly where the shortcomings of MIR optimization lie?

1 Like

You can run the benchmarks under a profiler, e.g. perf or cargo flamegraph to see where the hotspots in the compiled code are, then work backwards from the assembly to the corresponding LLVM IR and MIR and see if we could convey additional information to LLVM or if the MIR could be optimized in a way that unlocks additional optimizations.

Often it takes combination of improvements throughout the stack to see a benefit.

5 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.