mordaunt.dev/site

work / Sprig

Sprig

Made a cross-platform chat client start fast on Windows by replacing file-per-message storage with an embedded database.

client
Arbor, open source
role
Contributor
year
2022
status
Paused by its author
platforms
Windows, macOS, Linux, Android, iOS
stack
Go, Gio, BoltDB
source
https://git.sr.ht/~whereswaldon/sprig
Sprig

Sprig is a client for Arbor, a federated chat platform, written in Go with Gio and shipped to five platforms from one codebase. Its author has since put it on ice; the work below is from 2022.

The problem

Sprig stored every chat message as its own file. Linux tolerated that. Windows did not: reading thousands of small files at startup made the client take seconds to open, and the cost grew with every conversation.

What I did

I moved persistence from the filesystem to BoltDB, an embedded key-value store in pure Go, keeping the local-first model and the simplicity that came with it. Startup became fast on every platform, with the largest gain on Windows, where the problem had been worst. Alongside it, smaller refinements to the interface.

Why it is here

It is a small change with a large effect, made by measuring where the time went rather than guessing, and it left the program simpler than it found it.