Practical diagnosis17 / 19

Game performance

What to check when a game starts slowly, stutters, or uses more and more memory.

If a game runs slowly, first determine where the delay occurs: loading files, executing code, or rendering frames.

We use the following panels to investigate:

  • Network: which files the game loads, their sizes, and how long the downloads take.
  • Performance: a recording of the page’s activity. It helps identify a slow function or measure the time spent rendering a frame.
  • Memory: snapshots of objects in memory. Compare the state before opening a scene and after closing it to see which objects remain and what still refers to them.

For example, if window still holds the closed scene’s event handler, the scene may remain in memory. We examined this connection in the lesson on memory leaks. Increasing memory use alone does not prove a leak: we need to find objects that the game no longer needs but still retains.

In the interactive diagram, we will select a problem and see where to start investigating.

After changing the code, repeat the same actions on the same device and compare the results. For example: does the first scene open faster, has stuttering stopped, and have old scenes stopped accumulating in memory?

What is happening in the game?

Select a problem to see what to check.

SYMPTOM
A long wait for the game to startThe menu or first scene takes a long time to appear.
INVESTIGATE
Loading files and running startup codeWhat takes time before the game appears.

In Network, check which files take a long time to download. In Performance, check what the code does during startup. This helps identify where time is spent.

1 / 3
Key takeaway

First, identify where the game spends time or memory. Then change the relevant part and repeat the same check.

Check the primary source ↗

Chrome DevTools · Performance↗Official tools for recording and analyzing performance.Chrome DevTools · Memory↗Official tools for diagnosing memory use, leaks, and frequent garbage collections.Chrome DevTools · Network↗Inspecting file sizes and download times.