From 90 seconds to 7: faster page downloads
The first batch of 40 pages took about 90 seconds to download. That's a long wait for a sign to wake up, so I looked at where the time went.
Three slow things
- A new secure connection for every page. Setting up a secure connection is the slowest thing the board does, and it did it 40 times.
- The server rebuilt the whole collection for every page.
- Wi-Fi power saving. The chip naps between packets by default, which makes sense on a battery and not on a board plugged into the wall.
The fix
The board now asks for the whole batch in one request. The server builds your collection once, draws all 40 pages, and sends them together. Wi-Fi stays awake.
The first batch now loads in 7.4 seconds, more than twelve times faster. It was also the first update installed over the air, which proved that the update system works on real hardware.