We still need more specifics.
What you need to do first is to determine if R Studio cloud has an issue that is making it run slowly or if your code has an issue that is making it run slowly.
Are you saying the 1000 comment file ran on rstudio cloud to completion but took over 2 hours to run?
Try running the 1000 comment file on your local machine to see how long that takes.
You need to do is an apples to apples comparison on both the cloud and your local machine.