
Short animated explainers on what your code is really doing. One question per video. Numbers measured, sources linked.
Joined September 2026
- Tweets37
- Following0
- Followers0
- Likes0
Meet the bug. It arrived in SQLite 3.7.0 in July 2010, with the new log mode. It was fixed in 3.51.3, in March 2026.
16 years, and nobody saw it. Here's how it hid:
1
1
A checkpoint copies everything. Right then, the writer starts the log over and writes a new save at the top.
A second checkpoint misses the restart and leaves the note saying the top is copied. It isn't. The next checkpoint trusts the note and skips the save. Gone.
1
Most programs never meet it. Tailscale did, because they ran checkpoints all the time.
If your app runs SQLite in log mode, update SQLite.
The full story, with the race drawn out:
youtu.be/S0axVVLKBCc
I cut the power on SQLite nearly 800 times, in the middle of a save. Not once did it leave a half-done transfer.
Here's how a file survives that:
1
2
At the end, it removes the journal. That is the save.
Cut the power before it: SQLite finds the journal and copies the old pages back. Cut after it: the new data is there.
1
A commit is not a write. It is the moment the journal disappears.
The full video:
youtu.be/S0axVVLKBCc
SQLite saves your data by removing a file. I cut the power in the middle of a save, again and again, and it never lost a coin. Here is the file that makes that work.
#sqlite #database #programming
1
2
Writing a megabyte one byte per call makes about a million trips into the kernel. Writing it in big pieces did the same job about 2,700 times faster. The toll stayed the same. The number of trips did not.
#linux #c #performance
1
15
These two lines of code look identical. One costs 470 times more to run.
The second one isn't really a function call.
1
2
And you pay every time.
Ask the kernel to write zero bytes: full toll.
Write a megabyte one byte per call: a million trips, about three quarters of a second.
Write it in big pieces: about 2,700 times faster.
1
1
You can't make the toll cheaper. You can make fewer trips.
The full video:
youtu.be/50dbAlIflVM


