Elffuss BraidHub

utopia-ia/elffuss-braid public

2da7deeea818 · 7.8 KiBSourceRawPermalink

Benchmarks against git

run.py does the same work with braid and with git on one machine and says how long braid took as a fraction of git's time, or how large its store is as a fraction of git's: braid / git. Below 1 means braid is faster or smaller, above 1 that it is slower or larger.

Braid publishes only these ratios, together with this script. Absolute times, sizes and the description of the machine stay on the machine that measured them.

Running it

python3 bench/run.py                    # every scenario, full size
python3 bench/run.py --quick            # small inputs: a smoke run, as CI does
python3 bench/run.py --only status,commit
python3 bench/run.py --list             # the scenarios
python3 bench/run.py --markdown         # also print the table as Markdown

It needs a Unix-like system, Python 3.9 or newer (standard library only), git, cargo and du. It builds braid with cargo build --release first; --braid PATH uses a binary you already have. The full run fetches the repository of the import scenario once from GitHub.

Everything happens in a new temporary directory, removed at the end: --workdir DIR puts it elsewhere and --keep keeps it. The script checks that there is room for its inputs there before it starts. Your git configuration is never read or written: every git command runs with GIT_CONFIG_GLOBAL=/dev/null, GIT_CONFIG_NOSYSTEM=1 and a fixed identity.

The table goes to standard output. The raw measurements, every time of every round, go to bench/results/, which git ignores.

How it measures

Scenarios

import

The source is tmux at its 3.5a release, 10,287 commits, fetched once with git into a local bare repository whose only branch is main. Three rounds of:

--no-local makes git go through its transport, building and indexing a pack, instead of copying or hard-linking the source's files. Braid's import also exports every commit again and compares the ids, so that the round trip is bit for bit.

--source URL_OR_PATH (with --source-ref REF) imports another repository; --quick imports this repository's own history.

status

A generated tree of 100,000 files: three levels of directories, 25 files in each directory, text of 100 to 3,000 bytes, the same bytes on every run. Git checks it out from one commit, and braid imports that commit and checks it out in a workspace. Nine rounds of braid status against git status, twice: with git's untracked cache off, then with core.untrackedCache=true; the file system monitor is off in both (no daemon). Two cases: a clean tree, and 10 files spread over the tree with a line appended.

commit

In the same tree, one file gets a line appended and is committed: nine rounds of braid commit against git add <file> and git commit, a different file each round. Braid has no staging area: its commit scans the working copy, as a status does, and records what changed.

wide

A single directory of 20,000 small files. Each round adds one new file at the end of it and commits it, 200 rounds, three ways:

The table gives the ratio of each braid way to git, and then whether the cost of one commit grows with the directory: the same series, 30 rounds, in directories of 2,500, 5,000 and 10,000 files, and for each tool the cost of one commit with 20,000 files divided by its cost with 2,500. 1 means the cost does not grow with the directory; a cost proportional to it would give 8. The raw results also have the exponent of a fit of cost against size, and how much the last quarter of the 200 commits differs from the first.

agents

N = 4, 8 and 16 agents start at once. Each makes K = 10 commits, appending a line to its own file, and lands each one before the next:

The time is the wall-clock time from the start until the last agent has landed its last commit. Three rounds for each N, with new repositories each time. The table also says how many times git retried a push, on average.

store

After the import, du -sk of .braid/store against du -sk of the bare clone after git gc --aggressive --prune=now. The raw results also have the sum of the file sizes alone, and the size of the clone before the gc.

history

On the imported repository, and on the bare clone after its gc:

Braid follows first parents, so git does too, and both list the same changesets; the scenario checks it. A query that braid does not have yet is skipped, and the table says so.

Reading the ratios

What it does not measure