Or played Doom, for that matter.
There's a bad apple demo on the datastar site. Datastar's[1] streaming hypermedia is what makes this possible, that and good old Clojure and sqlite.
I put this together in a day and wasn't planning on it being on HN. So there's definitely some jank/UX polish.
For example the typing experience is nicer on chrome as the field sizes to the text.
andersmurphy•5h ago
Happy to answer any questions.
andersmurphy•4h ago
konsalexee•4h ago
andersmurphy•3h ago
The scaling was preemptive as it was hitting 150% CPU (out of 200%). Needed to power down to rescale.
Now it's hovering at around 200% (out of 400%). About 80kb/s and 10 disk iops.
Everything goes via a sqlite db.
daymanstep•3h ago
andersmurphy•3h ago
But because it's sqlite it's a single writer. Everything gets batched as one transaction every 100ms. The operations on a single chunk gets squashed into a single write.
Even without the squashing sqlite can handle 10000-20000+ updates/s because of the transaction batching.
With the chunk based squashing all edits to a chunk in that 100ms window become one update, so it can scale quite well.
matsemann•2h ago
andersmurphy•2h ago
matsemann•2h ago
Btw, if I add a ' to the string, it's impossible to override by othrs. At least in the UI on Firefox, the snake still ate it.