taskforce

2024.07 - From Zero to Perfect CPU Scaling

July 1, 2024 · 3 min read

CPU scaling is not optional. Your flock prototype can look fine at 350 boids and still cost 35ms. That is ~30 FPS. And your GPU can still be fine (14 batches, 10K triangles) while the CPU is the thing killing you.

First sanity check: open Profiler, make sure you are not VSync-bound, and measure the cost of the behavior update itself. If your update loop is already eating the frame at 350 elements, you do not have a “scaling problem”. You have a production problem.

Unity Profiler showing CPU-bound baseline

The fix is not one magic trick. It is a step-by-step iteration ladder with clear stop rules: prototype, validate with the team, then improve only as far as reality forces you. No early overengineering. No late denial.

In this module you walk the full path on the same flock problem: GameObjects (naive Update), then ECS to cut engine overhead and fix memory layout, then Jobs + Burst to spread work across cores, and finally spatial partitioning to stop doing N-squared neighbor checks across the entire world.

One reality check most teams miss: once you jobify things, the Main Thread can look “fine” while your worker threads are on fire. If you only stare at main thread time, you can ship something that falls apart on weaker CPUs. You must track total CPU time too.

The proof screenshot below is from the module’s benchmark table on a Ryzen 7940HS. For 350 boids, the baseline is about 13ms on the main thread. With Jobs + Burst it is about 0.09ms. And when you push into big counts, spatial partitioning is what keeps the whole thing from collapsing.

CPU cost overview benchmark table

CEO/Producer translation: this is how you stop one “nice-to-have” feature from exploding into a schedule and performance crisis at the end of production.

This page is a preview. The full step-by-step module with the exact code path, profiler screenshots, and decision rules is members-only below.

In this module:

Join to unlock the full module, audio, and resources.