Profiling
Introduction
Gum provides a few diagnostic tools for finding and fixing performance problems. This section discusses how you can find problems with your Gum application
Rendering
Internally Gum uses a SpriteBatch for rendering. It attempts to use as few Begin/End pairs as possible, but it will end a draw batch if necessary. The following changes require a batch to be interrupted:
Changes in textures. Examples include:
Two SpriteRuntimes which use different textures
A TextRuntime and a non-TextRuntime (such as a NineSlice) will introduce a break in rendering unless the TextRuntime's font shares a PNG with the non-TextRuntime
A ColoredRectangleRuntime and a non-ColoredRectangleRuntime, unless the SinglePixelTexture is on the same PNG
Changes in clip region by setting ClipsChildren to true
Changes in render targets by setting IsRenderTarget to true
Gum provides a list of changes which can be inspected to spot where render problems might be occurring.
Code Example: Checking Performance
The following code shows how to check the performance of a simple project. Note that this code creates visuals instead of Forms controls to intentionally create render breaks.
Pressing space outputs diagnostic information about the rendering similar to the following output:
Last updated
Was this helpful?