Whats is the difference between using risk() and cvrisk() in the R package mboost

I am currently running an additive model using the function gamboost() in the package mboost. When using the cvrisk() function to extract the stopping iteration, it takes a lot of time to compute it. However, I saw that there is another function called risk(), that extracts the computed risk and it takes only a couple of seconds. What are the differences between those two functions? Can I use the risk() function to extract the stopping iteration?

cvrisk() is performing some form of crossvalidation to evaluate the empirical risk for the model hyperparameters. The number of boosting iterations is a hyperparameter. You use this to try to stop overfitting.
You can extract the risk assessed on the in or out of bag samples used during fitting; this is what risk() does. This likely gives over-optimistic results for the number of boosting iterations, either because it uses the same data to test as well as fit the model or all the data is used in the model at some point so is not truly independent.
The authors of the software recommend that the number of boosting iterations be chosen using crossvalidation via cvrisk(). The default does 25-fold bootstrapping. This involves refitting the model 25 times, which logically takes additional time. This way, the empirical risk is evaluated on a true subset of the data that is never used to fit each model.