new post: the senior engineer death spiral
https://t.co/xzgU1jVBRh
a friend just started a big job and asked for some advice. so I braindumped a monologue about a super common failure mode I see with engineers and posted it here, hope it helps whoever it can.
Somehow a 100-line SQL query is considered unmaintainable, but splitting the same logic across five services and a message queue is considered architecture.
I trained a small model to do syntax highlighting in the browser with GPU.
Meet gpu-lexer from Vercel Labs: Small (27.5KB), fast (runs on WebGPU), and language-agnostic (model guesses the syntax).
https://t.co/adphvt2Lv4
It is experimental and built for learning!
My favorite trick to reduce memory overhead in a Go app is to replace all time.Time references with int64. time.Time is 24 bytes versus 8 bytes, so a 3x improvement. There's also a GC improvement since time.Time contains a *Location pointer.
We maintain a few indexes in our engine which are ordered by priority and timestamp (these are queue-related indexes). We'd like to do everything possible to ensure this index fits in memory (and only fall back to disk with enormous backlogs).
In our first implementation, we'd read these rows out of the database to construct the index and convert pgtype.Timestamptz -> time.Time. But this strategy only let us fit a few million entries in memory on a 2GB machine. After a light refactor and partially due to this fix, we're nearing hundreds of millions of slots.
This is nowhere near Cloudflare's level of optimization but was very leveraged in our case.