There are two main benefits from suffering. It serves as an atonement for transgressions, and as an incentive for us to improve our behavior.
When you improve because of your suffering, appreciate the suffering since you have gained immensely because of it. ~ Rabainu Yonah in Shaarey Tshuva 2:3,4