I have Revit Add-in that I'm converting to Design Automation (DA) Add-in. Addin takes input as xml file and outputs rfa file. On Revit side code executes in about 0.5s, but when I upload it to DA it takes about 30s - 40s to execute. I'm trying to cut down on this time. So far I have tried Storing template file in AppBundle according to https://forge.autodesk.com/blog/store-template-documents-appbundle and moving my storage to EMEA region. This cuts down my time to about 20s - 30s. My goal is about 10s, what else could I try to further cut down execution time?
Yes, caching your templates in the AppBundle is the recommended approach. Adam Nagy's blog is a good reference. As also suggested in comments looking up report.txt for bottlenecks is a good practice.
However, unfortunately there is a known overhead for running Design Automation in Revit. Starting up Revit and loading your addin in DA for Revit can take up to 20 secs (give or take). At this point we can't do better than that.