Putting the boat on a diet

Projects
Performance, Webpack, Elixir

A fundamental premise for popsicleboat is no ads, no tracking, no scripts riding along on your site if you host your comments there. Also, it should be as lightweight as possible without sacrificing features. It occurred to me to check what happens when I use it for comments (a main feature) on this, my site.

I measured a logged-out thread page. 843 KB. For what? So I dug in.

The ledger #

Bytes
JavaScript325 KB
Images276 KB
CSS229 KB
HTML13 KB

Cut one: the call system nobody logged-out can use #

A third of the JavaScript was the WebRTC video-calling machinery, so signaling, peer connections, reconnect logic, the call dock, etc. All of it shipped to readers who can’t place a call, because calling requires an account.

The fix was a webpack dynamic import: the entire call system moved into a chunk that only loads when the page carries a signed-in signal.

Cut two: a 40-pixel logo served as a giant PNG #

The header logo is an ankh about 40 pixels tall. It was being served as a 923×1352 PNG, twice, a light variant and a dark one. That’s 244 KB for a tiny glyph. One ImageMagick command took it to 9 KB. I’d been busy tuning the JavaScript I found interesting while the real weight was three files I hadn’t looked at since the beginning.

The ledger, after #

StoredOn the wire
JavaScript213 KB65 KB
CSS217 KB39 KB
Images24 KB13 KB
HTML13 KB13 KB
Total468 KB~130 KB

A Phoenix LiveView social app with a video-calling system and live chatting, invisible until you sign in, now costs a reader less transfer than most sites spend on web fonts.

The details of untangling the JS are a little boring, so if you’re reading this know I deliberately spare you those. This is just a summary of what I found and how it is better now. I don’t want anyone to feel obligated to anything, but I want everyone to feel free to enjoy without bloat.

Replies from Popsicle Boat

robzombie ·

Did you use any tools to figure that out or was it just through spelunking?

Reply

jake ·

Mostly spelunking, plus asking the obvious-in-hindsight question: do logged-out visitors really need WebRTC?

Reply

Replies come from Popsicle Boat members. Accounts are required, it’s why there’s no spam. You’ll sign in there (or create an account, it takes a short minute), confirm before it posts, and land right back here after.

Left one of the replies above? It stays yours — you can edit or delete it in the thread, and this page follows on its next build.

512KB Club Orange Team member