The Go Performance Playground is an online CPU profiler for Golang. It allows developers to quickly measure execution time of the code, profile it to find bottlenecks with line-of-code precision, iteratively optimize algorithms, and more. Underneath, it uses StackImpact’s pprof-based profiler.
Go Performance Playground is written in Go and was inspired by the original Go Playground, a quick Go code executor via browser.
The user code is build with Go 1.8 and launched in a sandbox as Ubuntu 16.04 docker container. The resources of the sandbox are limited and are kept constant between runs.
The code should be written/copied into
run() function. The function will be executed multiple times to make sure the sampling profiler can collect enough CPU call stack samples. Alternatively, a loop can be implemented inside of the
run() function and the function is allowed not to finish.
Any initialization code should be put into
load() function so that it isn’t counted in execution time and CPU profiles.
After writing the the code, it can be executed using Run button or Ctrl+R shortcut.
An example is available at https://play.stackimpact.com/p/zIRPhlywKG.
Sharing profiling results
Profiling results can be shared using Share button. A new tab with a unique link to the shared code and results will be opened.
Local and production profiling
To profile applications locally and in production, StackImpact’s Golang agent should be used. It runs inside of the application and reports regular and anomaly-triggered profiles to the Dashboard. Besides CPU hot spot profiles, it also reports memory allocation, network and mutex hot spot profiles as well as various bottleneck profiles and runtime metrics. Learn more.