Have you ever needed to compare the difference in performance between two versions of your project? See the impact of an asset or code change, optimization work, settings change or Unity version upgrade? Read on to find out how our Profile Analyzer (Preview) can help you!

Built out of necessity

As part of Unity’s Platform Performance Team, we get to investigate all kinds of performance problems, on any of the Unity supported platforms or in any version of Unity. To do this, we rely heavily on the native platform tools and, of course, on the Unity Profiler.

During one such investigation, we found that we were struggling to find the most representative frames of data to dig into. So we built a tool that would aggregate multiple frames of profiler data and help us locate interesting frames for any given marker. This enabled us to more reliably reason about its change in behavior.

Analyzing a single data set

Profile Analyzer’s Single View can be populated from the current set of frames in the Unity Profiler window. It analyzes the CPU data and visualizes frame, thread and marker times/counts, including their minimum, maximum, median, mean and lower/upper quartile values, and gives links back to the Profiler Window for the frames they appear in. The distribution of time for frames, threads, and markers is also available as a histogram and box and whisker plot to help visualize behavior over time.

Comparing two data sets

Building on the information shown in the Single View, you can load two data sets in the Compare View. They will appear in two distinct colors. The difference between the two data sets is visualized in an ordered table. You can also see the distribution differences in the histogram and box and whisker plots. The two data sets can be from before and after a code/data change, a project-settings change or a Unity version upgrade.

Filtering the data

Your working set can be reduced with the use of the filtering controls. You can limit markers by a partial name match, which thread they ran on and a specific stack level.

Along with filtering to a specific name match, you can also elect to exclude a further set of markers by name to remove any markers that aren’t statistically relevant from the filtered set or are somehow distorting the view of your filtered marker set. Selecting a subset of frames is also available using the frame control at the top of the window.

The Compare View will automatically align the depth of the two data sets so that top-level markers are aligned correctly. However, you can override this using the Auto Right tick box and the Left and Right depth controls. This is especially useful when comparing data sets from different versions of Unity where the markers produced have changed.

Sharing the love

Profile Analyzer continues to be used internally to monitor performance and optimizations of key systems. Recently, it was used to review performance when optimizing Unity texture loading, where the creation of large textures caused render thread stalls. The searching and filtering made it simple to focus on the key metrics related to this area. To help all developers review and improve performance we released the tool as a package in sync with the 2019.1 release, give it a go and let us know how you get on, we’d love to hear your experiences on the forum.