INSIDE ZED Upstream ↗ Repository ↗
FIELD GUIDE / 09 · REPRODUCTION

From zero to reproducing the numbers.

Every figure on this site comes from code that runs. This page is the single entry point for doing the same: what to install, which commands exist, what each one actually proves, and where the limits are. It assumes no prior knowledge of the repository and ends with the paths an expert will want.

SCOPE - this page documents the commands of this study, not the commands of the Zed editor. The pinned checkout contains thirteen engine crates, not the application: there is no keymap, no extension runtime and no settings UI in it. Anything about editing in Zed belongs to the upstream documentation, and nothing here is presented as if this repository had measured it.

Five minutes, one toolchain

The quickest real result needs a Rust toolchain and no network beyond the first build. The test suite is self-contained: it links against the vendored crates and asserts Zed's own invariants.

# the version the pinned commit declares
rustup toolchain install 1.100.0

# all 33 tests
cd harness
cargo test --release

Expected tail, five suites:

tests/adversarial.rs       5 passed
tests/concurrency.rs       8 passed
tests/data_structures.rs  14 passed
tests/permutations.rs      1 passed
tests/ui_runtime.rs        5 passed

VERIFIED - measured on this checkout: 33 tests, 0 failures. The counts are the per-file totals cargo reports, not a rounded summary. harness/rust-toolchain.toml pins 1.100.0, so the toolchain line is not advisory: cargo switches to it inside harness/ even when a different default is installed system-wide.

Getting the source the code links against

The harness does not reimplement Zed. Its dependencies are path dependencies into a checkout pinned at one exact commit, so the build fails until that checkout exists. One script creates it as a sparse, blob-filtered clone.

# from the repository root
./tools/setup-zed.sh

The script fetches only the crates the harness reaches, which is why the result is thirteen crates rather than the whole editor. It verifies the commit afterwards and refuses to continue if the checkout landed elsewhere.

zed checkout ready at 2664a0aa1eae5dabf8f8273c03f88d53061ca7dc
crates present: clock collections gpui_util path rope scheduler
                sum_tree text util util_macros zlog ztracing ztracing_macro

WHY SPARSE - a full Zed checkout is large and most of it is irrelevant to a text-engine study. The cone-mode sparse list is the honest dependency closure: text pulls rope, collections and sum_tree; its test-support feature pulls util, path and util_macros, which is what exposes check_invariants().

Every command, and what it proves

Four entry points exist. They answer different questions, and running all four is what the published figures rest on.

Tests. DETERMINISTIC.

cargo test --release inside harness/ runs 33 assertions against the pinned crates. Proves the invariants hold and the concurrency rules behave as described. No timing involved, so any machine agrees.

Measurements. TIMING.

cargo run --release runs the measurement harness: insert scaling, appends, offset lookup, undo grouping, rope geometry. Produces the timings quoted on the measurements page, which move between runs.

Priority draw. STATISTICAL.

cargo run --release --bin priority-draw performs one million weighted draws over the real scheduler. Proves the 6:3:1 split and that a zero-weight priority is never selected. Fixed seed.

Site build. DETERMINISTIC.

python3 site/build.py rebuilds the published pages from site/. Add --check to exit 1 on drift, which is what CI enforces.

The two runner commands differ only by target:

cd harness

# the measurement harness
cargo run --release

# the priority draw
cargo run --release --bin priority-draw

VERIFIED - run on this checkout, the draw prints 60.063% / 29.921% / 10.015% against 60/30/10 nominal, a maximum deviation of 0.079 points over one million draws, and reports that the zero-weight priority was selected 0 times in a separate 200 000-draw check. Fixed seed, so those exact numbers repeat.

Reading a result instead of trusting it

The harness separates two kinds of output, and conflating them is the usual mistake.

Structural figures.

Chunk count, chunk size, tree shape, byte offsets, checksums. These reproduce bit-for-bit on any machine, so a disagreement means a real difference in the code or the input, never noise.

Timing figures.

Medians in nanoseconds. These move between runs and between machines. The published pages report a spread or per-run values, never one authoritative number.

REPRODUCIBILITY - the raw output of every published run is committed under harness/results/. If a fresh run disagrees with a page, the raw file is the reference and the page is what needs correcting. That rule is deliberate: it keeps the written claims subordinate to the artifact.

Re-running one thing

Once the suite is green, the useful move is to narrow it. Each test binary takes a filter, and the upstream suite can be run directly when the pinned crates are present.

cd harness

# one suite
cargo test --release --test adversarial

# one test, with its assertion output
cargo test --release --test concurrency -- --nocapture

# the upstream text suite the pinned checkout ships
cargo test --release -p text

Without --nocapture, cargo swallows the output of passing tests and a failure shows only a summary line.

The expert paths

Three checks are worth knowing before changing anything, because each one silently changes what a result means.

# confirm which toolchain is really active inside harness/
cd harness && cargo --version && rustc --version

# confirm the checkout is exactly the pin
git -C vendor/zed rev-parse HEAD

# confirm the published site matches its sources
python3 site/build.py --check

ANALYSIS - the first command is the one that catches a machine-specific failure. A default toolchain elsewhere on the system does not matter: inside harness/, rust-toolchain.toml wins and cargo reports 1.100.0. If it reports anything else, the pin is not being honoured and every timing is suspect.

Changing the pin is a deliberate act, not a routine bump. ZED_PIN lives in tools/setup-zed.sh and the same hash appears throughout this site, so a new pin means a new checkout, a re-run of all four commands, and updated results files. Anything less publishes numbers attributed to a revision that did not produce them.

HYPOTHESIS - timing medians have so far been compared only across runs on similar hardware. Whether the spread on the noisiest section is dominated by machine load or by allocator behaviour is not established by the current runs, and would need a controlled A/B on one host to settle.

What this page does not cover

Stated plainly, because the gap between this project and Zed is where a reader gets misled.

NOT DOCUMENTED HERE

Installing the Zed editor, keyboard shortcuts and keymaps, themes, settings, extensions and plugins, language servers, collaboration setup, and any editor-level workflow. None of those live in the pinned checkout this study builds against, so none of them are described here. The absence is a boundary, not an oversight.

The study covers the engine: text, rope, sum_tree, clock and scheduler. Each has its own page tracing the real implementation and the tests that exercise it, starting with the architecture map.