Dice Lock's game screen now loads on a phone in 6 seconds, not 15Dice Lock's game screen now loads on a phone in 6 seconds, not 15
September 20, 2026 · Dice Lock's main game screen went from 15 seconds to 6 on a throttled phone, once I stopped borrowing Google's fonts and started compressing the server's own pages.Dice Lock's main game screen now loads in 6 seconds instead of 15 on a slow phone, once I stopped fetching fonts from Google and started compressing the server's pages.
Every load-time number this project had quoted was arithmetic over file sizes: count the modules, add up the bytes, guess. Today I actually measured it, loading Dice Lock's pages in headless Chrome over a connection throttled to imitate a phone on a weak mobile signal, and the guess had been generous. The main game screen was shipping 1.03MB over 77 requests, and on that connection a phone had nothing to tap for six seconds. The homepage, by contrast, is server-rendered HTML that was already fine.
Two of the biggest costs turned out to be self-inflicted. The game's typeface was being pulled from Google's own servers, so before a single pixel could paint, the browser first had to resolve a host it had never spoken to, finish a handshake with it, and only then discover the actual font files lived on a second host again. And the server itself compressed nothing it sent: a generated page like the stats view went out as 23,950 bytes of plain text that would have shrunk to 8,880 with the compression almost every server already does. Both are fixed now: the font files live alongside the game itself, and every response leaving the server is compressed and carries a cache header that matches how the game is actually served. Measured before and after on the same throttled setup: the game screen's time to first paint fell from 15,196 milliseconds to 5,960, and the bytes it took to get there dropped from 2.78MB to 996KB. The homepage went from 1,120ms to 620.
Later the same day, a second piece of the same problem got fixed. The menu screen had been loading the entire game before it painted anything (the battle engine, the AI, the tutorial script, the replay viewer), none of which a visitor reading the Controls screen ever touches. Moving those four behind the moment a player actually picks a mode, instead of behind the menu itself, took the game's real first interactive frame from about 6,148ms down to roughly 5,640 on the live site.
That split also created a new way to break. A browser that fails to fetch one of those now-deferred pieces remembers the failure and won't ask the network for it again for as long as the page stays open, so one dropped connection while a match was starting left the PLAY button permanently dead, with nothing on screen telling a player why and no fix short of reloading the whole page. That's fixed too, by having a retry ask for a URL the browser has never seen rather than the one it already gave up on.
The test suite behind all of this used to only report these numbers: every run printed each one as over or under its target and exited clean regardless. It now fails a run that makes any previously-measured number worse, and that change caught a bug in the measuring itself on its first day working: a full run had been quietly overwriting the saved best times with an empty result, because reloading the page mid-test was landing on top of a match already in progress and wiping its state before the numbers were recorded.
Every number this project had for how fast Dice Lock loads was a guess based on file sizes: add up the bytes, estimate. Today I actually measured it, loading the game's pages in an automated browser set to imitate a phone on a weak cell connection, and the guess turned out to have been kind. The game's main play screen was sending 1.03 megabytes of data over 77 separate downloads, and on that weak connection a phone had nothing on screen to tap for six full seconds. The homepage, by comparison, is a plain page that was already fine.
Two of the biggest costs were things the game was doing to itself. Its typeface was being downloaded from Google's own servers, so before a single pixel could appear, the phone first had to look up a website it had never visited, complete a secure handshake with it, and only then find out the actual font files lived on yet another website. And the game's own server wasn't shrinking anything it sent: one of its generated pages went out as 23,950 bytes of plain text that would have shrunk to 8,880 bytes with the basic compression almost every website already uses. Both problems are fixed now: the font files now live alongside the game itself instead of on Google's servers, and every page the server sends out is compressed and labeled so the phone knows how long it can keep a copy. Measured before and after on the same weak-connection test: the time before the game screen shows its first frame dropped from 15,196 milliseconds to 5,960, just under six seconds, and the amount of data it took to get there dropped from 2.78 megabytes to under a megabyte. The homepage improved too, from 1,120 milliseconds down to 620.
Later the same day, a second part of the same problem got fixed. The game's menu screen had been loading the entire game before it showed anything at all (the battle engine, the computer opponent, the tutorial, the replay viewer), none of which someone just reading the Controls screen ever touches. Making those four pieces load only once a player actually picks something to play, instead of the moment the menu opens, cut the time before the game is truly ready to use from about 6,148 milliseconds down to roughly 5,640 on the live site.
That change also created a new way for things to go wrong. A phone that fails to download one of those now-delayed pieces remembers the failure and refuses to try downloading it again for as long as the page stays open. That meant one dropped connection while a match was starting could leave the PLAY button permanently unresponsive, with nothing on screen explaining why and no way to recover short of reloading the whole page. That's fixed too, by having a retry ask for a slightly different web address that the phone hasn't already given up on.
The automated check that measures all of this used to only report these numbers: every run printed whether each one was over or under its target and finished without complaint either way. It now stops a run entirely if any previously-measured number gets worse, and that change caught a mistake in the checking process itself on its very first day working: a full run had been quietly overwriting the saved best times with an empty, meaningless result, because reloading the page partway through the test was interrupting a match that was still in progress and erasing its data before the real numbers could be recorded.