Client speed: loading and drawing
15 to 16 Nov 2026
- On a 5 Mbps line, a first visit that goes straight into a game now draws its first frame 1.2 to 1.8 s sooner.
- Two CSS pulse animations cost 86 ms of painting every second. We changed them to scale and fade instead, and page painting fell to 28 ms a second.
- The obfuscator made the page code 23.7% bigger and a build took 394 s. Without it, a build takes 26 s.
- Turning off page effects saved 26% of the main thread, more than any step in picture size.
On slow laptops, the page around the canvas and the first download cost more than the game’s own drawing.
Making a canvas game fast on a slow laptop is mostly not about the canvas. It is about what downloads first, what the page repaints around the game, and what the frame’s script allocates. The wiki page Making it fast describes the current state.
Measured how: we served production builds the way Cloudflare serves them, over a shared 5 Mbps link with 28 ms of latency and the CPU slowed down 4 times, and took the median of 3 runs. We measured the busiest frame at 1366 by 768 with the GPU on and the CPU slowed down 4 to 10 times. The machine was shared (its load was 2 to 89 across these runs), so we report the milliseconds each thread used per second, which stays steady under load.
| Measured | Before | After |
|---|
| First visit straight into a game, time to the first frame, slow line | 7.3 to 7.8 s | 1.2 to 1.8 s sooner |
| Game code chunk (with the server’s room code left out) | 350 KB | 122 KB |
| Page painting in the busiest frame (two CSS pulses changed to scale and fade) | 86 ms a second | 28 |
| Main thread with page effects turned off, at High quality | 595 ms a second | 364 |
| Page code with the obfuscator, then without it | 2,754 KB | 2,228 KB (brotli) |
| A production build | 394 s | 26 s |
Every table is in the wiki: Making it fast.
We removed the obfuscator. The server decides everything that matters, so the obfuscator hid nothing a cheater needs. It also made every error report unreadable and made every build take minutes.
Auto quality lowers the picture in steps when frames run slow. It now measures each step it tries, and it keeps a step only if the step improved the p95 frame time by 1 ms or cut missed frames by 40%.
What didn’t work
- Preloading the physics WebAssembly in the HTML: it downloaded ahead of the page’s own code, and Home appeared about 100 ms later.
- The first version of Auto that measured its steps: it lowered the picture for players during capture celebrations. We turned it off the same day and turned it back on once one-off moments no longer counted.
- Trimming the obfuscator’s options: the code was still 17.2% bigger. Only removing it brought the frame time back.
- An earlier reading said a cache for labels saved 0.9 ms a frame. The benchmark had no fonts loaded; the real saving is about 0.06 ms.
Reuse
- CSS animations that repaint, such as box-shadow pulses, can cost a slow laptop more than the game. Animate transform and opacity instead.
- Check what is inside each chunk. A convenience import had put the server’s code in the client bundle.
- A service worker install should reuse the HTTP cache and wait until the page is idle before fetching the rest.
- Time the build. One JavaScript pass over every module can slow down a whole day of deploys.
All the numbers are in the wiki: Making it fast.