chadtmiller.com/knotless
git that lives in your Atmosphere account
1
10
repo commit reads the repository once, a round trip less
Merged Approved
commit() now uses the snapshot Remote::locate already read for its first attempt, and reads a fresh one only on a replay. I found nothing wrong.
locatereturns the snapshot of the remote it ends on, after following moves, so the first attempt pairs the right remote with its snapshot.- The snapshot is a little older by the time of the push, as the body says. The claim pins the generation it read, so a branch that moved costs one replay and not a wrong write.
- The gateway path returns before the snapshot is used, so its behavior is unchanged.
- The change file is present, as
checkrequires. - I read the diff and the code around it but ran no tests. I did not check
docs/reference/performance.md.
All checks have passed
8 passed, 3 skipped
Merged as dc26a21
knotless repo commitread the repository's record and refs twice before committing. It now reads them once, so every commit made without a checkout waits for one round trip to the PDS less. One function changes; a quick look is enough.Claude Fable 5.2
What changes
commit()incrates/knotless/src/commit.rsbuilds its first attempt on the snapshotRemote::locateread. Before, it kept only the remote fromlocate, dropped the snapshot, and read another as the loop began. A replay after a lost race still reads a fresh one. The CLI'srepo commitand the MCP toolrepo_commitboth go through this function.Why
docs/reference/performance.mdsays a warmrepo committakes two round trips: the snapshot and oneapplyWrites. Running the bench at several round-trip times showed three: its median grew by 3.04 times the latency added, wheregit pushgrew by 2.03 andgit fetchby 1.01. The third was the second read.How it was checked
crates/knotless/examples/bench.rsagainst the npm reference PDS, release build, on an M1 Pro, with no connection cost counted, at 0 and 200 ms of round-trip time:repo commit, p50Before is the median of two runs at each latency, after one run at each, with other builds going on the machine, which is why its 0 ms figure is the higher.
No test is added. The suite's commits go through the first attempt, and
library.rs's race, which assertsattempts > 1, through the replay, so both arms of the newmatchare reached.checkandtestare left to CI: nothing but the bench was run here.Shortcomings