Frontend challenge: why phones got hot and how we fixed it
By Swapnil Shah · Updated 2026-11-24
The first version of the Atom Reaction board looked great and made phones hot. Players noticed after ten minutes of play. This is how I found the cause and fixed it.
The symptom
The game drew the board on an HTML canvas. On a modern phone with a 120 Hz screen, the browser asked for a new frame 120 times a second, and the renderer happily redrew the entire board every time, even when nothing was moving. Every orb had a soft glow and a gradient, which are expensive to draw.
Measure first
Before changing anything I measured frame cost in a headless browser. A board with 73 orbs took 1.7 milliseconds per frame to draw. Not huge for one frame, but multiplied by 120 frames a second for an hour, it adds up to a phone that is warm to hold.
Fix 1: draw orbs once as sprites
Instead of calculating the gradient and glow for each orb on every frame, I draw each orb style once to a small hidden canvas, a sprite, and then copy it with a cheap image draw. That cut the cost per frame from 1.7 to 0.7 milliseconds, about two and a half times faster.
Fix 2: do not draw when nothing changes
The renderer now runs at about 30 frames a second while idle and 60 only while explosions are flying. Later I made it smarter still: it redraws only when something actually changed, drops to a very low rate after 30 seconds of inactivity and shows a still picture once the game is over. On a 120 Hz phone this is about ten times less drawing work.
Fix 3: lite mode for older devices
Some phones are simply slow. The game now switches to a lite mode automatically on devices with four or fewer cores, two gigabytes of memory or less, data saver enabled or reduced motion requested, and also when it notices the screen is dropping frames. Players can override this in Settings with Auto, Lite or Full.
Fix 4: quieter sound and effects
The audio system was keeping the phone's audio hardware awake. It now suspends after three seconds of silence. I also removed a blurred backdrop on dialog windows, which was surprisingly costly on low-end devices.
What I measured afterwards
On a laptop test, the main thread usage while idle fell from about 20 percent to under 7 percent in lite mode, and memory stayed flat over a long run. I was careful to note that I could not measure on every real phone, so I kept the settings adjustable instead of promising one number.