Elffuss BraidHub

utopia-ia/elffuss-braid public

README: braid against git, as measured

A new section, linked from what is honest about this, gives braid's time
or store size as a ratio of git's for each scenario of bench/run.py, with
the command that reproduces it, and says plainly where braid is slower
and why: whole file versions instead of deltas, a single-threaded import
and working-copy walk, whole-directory rebuilds in wide directories, and
a store map built by every command. It is faster when many agents land at
once. CONTRIBUTING points at the script.
Changesetf3b070cd7b7a243b61dc1123f4a5642742e504b9b290b93c848cfa47436b962a
AuthorKikoCis <KikoCis@users.noreply.github.com> · 2026-10-16 02:06 +02:00
CommitterKikoCis <KikoCis@users.noreply.github.com> · 2026-10-16 02:06 +02:00
Parentsbbbac97cbab4

Browse the files at this changeset

2 files changed

modified CONTRIBUTING.md +2 −1
@@ -36,7 +36,8 @@
3636 version.
3737 - **Performance claims come with a reproducible script** and are stated as a
3838 ratio against git on the same machine. Do not publish absolute timings or
39- describe your hardware.
39+ describe your hardware. [`bench/run.py`](bench/README.md) is that script
40+ for every number in the README.
4041 - **Tests come with the change.** Bug fixes include a test that fails without
4142 the fix.
4243
modified README.md +70 −4
@@ -22,7 +22,7 @@
2222
2323 ---
2424
25-**In this repository:** [why braid](#why-braid) · [how it works](#how-it-works) · [quick start](#quick-start) · [working with git](#working-with-git) · [design](#design) · [status](#status-and-roadmap) · [what is honest about this](#what-is-honest-about-this) · [credits](#prior-art-and-credits)
25+**In this repository:** [why braid](#why-braid) · [how it works](#how-it-works) · [quick start](#quick-start) · [working with git](#working-with-git) · [design](#design) · [status](#status-and-roadmap) · [what is honest about this](#what-is-honest-about-this) · [measured against git](#measured-against-git) · [credits](#prior-art-and-credits)
2626
2727 ---
2828
@@ -240,9 +240,11 @@
240240 repositories, and runs workspaces for many agents on one machine. Keep your
241241 git repository as the source of truth, and do not keep anything only in
242242 braid.
243-- **No performance claims yet.** When benchmarks land they will be ratios
244- against git on the same machine, with the script that reproduces them, never
245- numbers nobody can check.
243+- **Slower than git at most things today.** [Measured against
244+ git](#measured-against-git) gives every result as a ratio against git on
245+ the same machine, with the script that reproduces it, never numbers nobody
246+ can check. Braid is faster when many agents land at once, and slower at
247+ importing and storing history, and at status and commit on large trees.
246248 - **The hashed format is frozen** and every golden vector is recomputed by a
247249 second implementation written from the specification alone. Storage and
248250 protocols can still change.
@@ -252,6 +254,70 @@
252254 or endorsed by Anthropic.
253255 - **Platforms.** CI tests Linux and other Unix-like systems. Windows is not tested yet.
254256
257+## Measured against git
258+
259+Each number is braid's time, or the size of its store, divided by git's for
260+the same work on the same machine: below 1 braid is faster or smaller, above
261+1 it is slower or larger. They are medians from one run of
262+[`bench/run.py`](bench/README.md), which describes every scenario, measuring
263+braid at commit `5330054`; the run held rounds back while other work kept
264+the machine busy (`--max-load`). The numbers come from that one machine, and
265+yours will differ: run the script before relying on any of them.
266+
267+| What was compared | braid / git | Reproduce |
268+|---|---|---|
269+| Import [tmux](https://github.com/tmux/tmux) 3.5a, 10,287 commits: `braid init` + `braid git import` vs `git clone --no-local --bare` | 17.6 | `python3 bench/run.py --only import` |
270+| Import it and check it out: `braid init` + `braid git import` + `braid workspace add` vs `git clone --no-local` | 17.1 | `python3 bench/run.py --only import` |
271+| Size after that import: `du` of `.braid/store` vs the bare clone after `git gc --aggressive` | 25.1 | `python3 bench/run.py --only store` |
272+| Status of a tree of 100,000 files, clean: `braid status` vs `git status`, no untracked cache, no fsmonitor | 2.6 | `python3 bench/run.py --only status` |
273+| Status of that tree, clean: `braid status` vs `git status` with `core.untrackedCache=true`, no fsmonitor | 5.8 | `python3 bench/run.py --only status` |
274+| Status of that tree, 10 files modified: `braid status` vs `git status`, no untracked cache, no fsmonitor | 3.0 | `python3 bench/run.py --only status` |
275+| Status of that tree, 10 files modified: `braid status` vs `git status` with `core.untrackedCache=true`, no fsmonitor | 5.7 | `python3 bench/run.py --only status` |
276+| Commit one changed file of that tree: `braid commit` vs `git add` + `git commit` | 5.0 | `python3 bench/run.py --only commit` |
277+| Commit one new file in a directory of 20,000 files, 200 times: `braid commit` vs `git add` + `git commit` | 1.8 | `python3 bench/run.py --only wide` |
278+| Commit one new file in that directory without a working copy, 200 times: `braid change create --land` vs `git add` + `git commit` | 0.9 | `python3 bench/run.py --only wide` |
279+| 4 agents land 10 commits each, at once: `braid commit` + `braid land`, a workspace each, vs `git commit` + `git push`, a clone each, with `git pull --rebase` and a new push when rejected | 0.4 | `python3 bench/run.py --only agents` |
280+| 8 agents, the same | 0.3 | `python3 bench/run.py --only agents` |
281+| 16 agents, the same | 0.2 | `python3 bench/run.py --only agents` |
282+| Newest 1,000 changesets of tmux: `braid log -n 1000` vs `git log --first-parent -n 1000 --format=%H` after `git gc --aggressive` | 1.7 | `python3 bench/run.py --only history` |
283+
284+`braid log -- <path>` and `braid blame` are not measured: braid does not
285+have them yet, and the script measures them as soon as it does.
286+
287+Braid is slower than git at most of this, and this is why:
288+
289+- **Importing and storing history.** Braid keeps every version of a file
290+ whole, compressed on its own, where git stores most versions as a delta
291+ against another; storing deltas is the next milestone. The import converts
292+ and checks every object on one thread, and much of that time goes to
293+ checking every entry name against the aliases of `.git`, with Unicode
294+ normalisation and case folding, each time a tree is read or built.
295+- **Status and commit on a large tree.** `braid status` walks the working
296+ copy one directory at a time on one core, opening each directory from the
297+ root one name at a time, so that it never follows a symlink, and looking
298+ for `.gitignore` and `.braidignore` in each; it also reads the whole base
299+ tree and rewrites the whole stat cache every time. It uses less CPU time
300+ than `git status`, which spreads its checks over several cores and, with
301+ the untracked cache, skips the directories that did not change.
302+ `braid commit` has no staging area, so it runs a whole status first.
303+- **A new file in a wide directory.** Braid writes only the few nodes of a
304+ large directory that change, but it reads and rebuilds the whole directory
305+ in memory to find them, checking every name again. From 2,500 to 20,000
306+ files, the cost of one commit grew 5.2 times for `braid commit`, 3.6 times
307+ for `braid change create` and 3.5 times for git.
308+- **Opening the store.** Every command first builds a map of where each
309+ object of the store is, which on a history the size of tmux's is a large
310+ part of `braid log -n 1000`; git looks each object up in its pack index
311+ when it needs it.
312+
313+Braid is faster where it was designed to be: many agents landing at once. A
314+push to git goes in only from a clone that has the latest commit, so each
315+agent that loses the race fetches, rebases and pushes again: on average 1.1
316+times per push with 4 agents, 2.5 times with 8 and 5.2 times with 16.
317+`braid land` rebases onto whatever landed first, in one short step that
318+landings take in turn, so no agent retried, and nearly every landing was
319+such a rebase.
320+
255321 ## Part of Elffuss
256322
257323 Braid is part of [Elffuss](https://elffuss.com), a family of tools for building