Profiling the Performance of a Google App Script

Viewed 5914

I've written a Google App Script to pull in Google Analytics data into a Google Spreadsheet. It's a fairly long running script making multiple requests to the GA Reporting API, it also uses Google App's ScriptDB.

Is there a good way of profiling each step of the scripts performance so I can figure out what areas are taking the longest, so I can begin optimizing in certain areas?

5 Answers

The basic tools are the execution transcript and Class Logger (mentioned on previous answers)

Nowadays we could use Stackdriver logging and Class Console which includes console.time and console.timeEnd.

And to make things betters, also we could send Stackdriver logging to Google Data Studio through BigQuery, so we could build helpful metrics to track profiling data.

References

Related