Description
We were upgrading from rust 1.78 to 1.79 and later 1.81 and we discovered a performance regression in our applications in certain cases up to 10%.
In our benchmarks we were using iai-callgrind
to measure instructions and we have seen a significant increase there.
Unfortunately, I can't provide exact code as they are proprietary but in the nature they have long callchains with lots of small functions.
The same issue was reported here.
I have bisected the 1.78 and 1.79 version and found that the following change causes performance regression: 3412f01#diff-deee82aaf9baf43ab05d939355f6249fdacf8959bc0e06c9574283453f838ee9R702
Release cargo profile
codegen-units = 1
opt-level = 3
lto = "thin"
Workaround
Adding debug = 1
to the profile in release mode essentially disables this change and the performance degradation is not there anymore as expected.