Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Executable size and VT throughput

Measurements on 2026-11-06, x86_64, Rust 1.96, patched Zig 0.17. The gate is 5,000,000 bytes, interpreting the testing budget's MB as decimal. Sidecar fonts are excluded. cargo xtask size builds the release executable, prints attribution, and fails above that limit. cargo xtask size EXE MAP inspects a saved pair.

Reproduce

nix develop -c cargo xtask build-vt
nix develop -c cargo xtask size
nix develop -c cargo run --release -p v7-vt --example throughput
nix develop -c cargo build --release --target x86_64-pc-windows-gnu -p v7-vt --example throughput
python3 scripts/check-win7-imports.py target/x86_64-pc-windows-gnu/release/examples/throughput.exe
python3 scripts/win7vm.py exec 'if not exist C:\v7\w10 mkdir C:\v7\w10'
python3 scripts/win7vm.py push target/x86_64-pc-windows-gnu/release/examples/throughput.exe C:\v7\w10\throughput.exe
python3 scripts/win7vm.py exec C:\v7\w10\throughput.exe
python3 scripts/win7vm.py pull C:\v7\w10\throughput.txt build/w10/throughput.txt

The benchmark creates four synthetic streams of at least 32 MiB each: ASCII lines, SGR color changes, CJK/emoji including a ZWJ sequence, and absolute/relative cursor movement plus erase. It feeds 64 KiB chunks to a 120 × 40 v7_vt::Terminal, warms 1 MiB before timing, and reports the median of three independently created terminals. Stream generation, terminal creation/destruction, and diagnostic formatting are outside the timed region. Windows uses QueryPerformanceCounter and the application's heap; Linux uses Instant and the host allocator. MB/s is decimal bytes per second. This measures VT parsing/state updates, including scrollback, not rendering. It does not establish a Renderer performance baseline. The Windows executable is no_std and has its own process entry through v7-platform-windows.

Attribution method and limitations

The linker wrapper emits *.exe.map alongside Cargo's hashed artifact in release/deps. Zig's cc frontend rejects both GNU -Map and MSVC /map switches; the wrapper captures Zig's verbose LLD invocation and replays that exact command with its bundled zig lld-link -lldmap:PATH before Rust deletes temporary objects. The second link writes the shipped executable too, so the map corresponds to that artifact.

The report charges address intervals between symbols, bounded by each input section, intersected with PE bytes present on disk. Aliases at one address count once. PE headers, section padding, and linker-generated data are the remainder. Zero-filled virtual memory is excluded. Fat LTO folds and inlines code across crates; generic functions can mention multiple crates. Accordingly these are estimates of linked ownership, not precise independent crate costs or a claim that each table can be removed. A merged Rust data section stays in the shared data bucket because the map does not show where each named static ends and unnamed constants begin. PE unwind tables and resources are reported by section. Zig std uses module prefixes such as Io, heap, mem, array_list, and fmt. Wuffs has its own input objects and is directly identifiable.

The original executable was 3,844,096 bytes. Font discovery was being implemented in the same checkout during this task. The mapped baseline below includes that concurrent work and must not be presented as a byte-for-byte rebuild of the original executable. Saved experimental artifacts and raw reports are in ignored build/w10/.

Candidates

  • ReleaseSmall: rejected. With kitty graphics disabled it produces a much smaller executable, but both platforms lose throughput well beyond the 5% threshold.
  • Kitty graphics/Wuffs: patch 0004 defaults lib-vt's existing upstream feature gate off. No decoder implementation is copied or stubbed. This removes its parsing, image storage, pixel operations, and Wuffs together. Re-enable with KITTY_GRAPHICS=true nix develop -c scripts/build-vt.sh; raw Zig builds support -Dvoyager7-kitty-graphics=true, or an explicit -Dvt-features list, which takes precedence. Kitty image rendering was deferred at the time (implemented later; see kitty-graphics.md). Other VT features remain enabled.
  • Panic/debug machinery: upstream already uses its tiny panic handler in both release modes and rejects accidental use of the full debug Io machinery at compile time (src/lib_vt.zig). No extra panic patch is justified. Assertions in Voyager7 remain enabled.
  • LTO/codegen/panic: fat LTO, one codegen unit, stripped symbols, and panic=abort were already configured. Retained; reducing correctness or losing diagnostics is not a size optimization here.
  • Unicode duplication: Rust core, harfrust, unicode-bidi/linebreak/segmentation, and Ghostty have overlapping Unicode knowledge but different generated layouts, property sets and interfaces. Symbol identity does not prove byte equality or compatible Unicode versions. No unsafe table coalescing was attempted.
  • PE: retain 4096-byte virtual section alignment, 512-byte file alignment, ASLR relocations, NX and high-entropy ASLR. Padding is small; removing relocations would sacrifice ASLR. No alignment change is justified.

cargo tree -d found actual parallel runtime versions: font-types 0.11.3/0.12.7, read-fonts 0.37.0/0.41.0, and skrifa 0.40.0/0.44.0. Harfrust and cosmic-text use the older family; swash uses the newer one. These are incompatible minor versions for pre-1.0 crates; changing Cargo.lock cannot safely unify their APIs. Updating or patching cosmic-text/swash is outside this task's profile-only Cargo ownership. The size report combines versions under each crate's name because LTO symbols do not reliably identify the version. miniz_oxide 0.8.9/0.9.1 is test-only through png.

Measured sizes

ConfigurationBytesDecision
Original task artifact, before concurrent font work3,844,096Reference only; no corresponding map
Mapped baseline, ReleaseFast, kitty enabled, Rust 33,968,000Before
ReleaseSmall, kitty disabled, Rust 33,013,120Reject throughput loss
ReleaseSmall, kitty disabled, external Rust dependencies s2,657,280Reject throughput loss
ReleaseFast, kitty disabled, Rust 33,429,888Keep feature removal
ReleaseFast, kitty disabled, external Rust dependencies s3,074,048Proposed final

Disabling kitty graphics saves 538,112 bytes; Rust dependency optimization saves 355,840 more. Together they save 893,952 bytes (22.5%) against the mapped baseline, leaving 1,925,952 bytes below the decimal 5 MB gate. Workspace crates, including the VT wrapper and allocator, retain opt-level 3. The wildcard package override applies only to external dependencies. No new third-party crate was added. The example uses the existing platform crate as a Windows-only dev dependency.

Attribution (estimated disk bytes)BeforeAfter
Ghostty Unicode86,75283,376
Ghostty Wuffs279,5180
Ghostty Zig std76,29455,878
Ghostty anonymous/shared306,786282,612
Ghostty terminal/core1,236,5501,044,468
PE headers/padding/linker20,24720,201
Rust anonymous/shared49,96446,704
cosmic_text156,22694,823
font_types0123
fontdb4,9286,793
harfrust452,024370,288
read_fonts243,812224,965
rest/runtime456,236347,680
skrifa320,080238,285
swash43,41632,064
ttf_parser32,96012,951
unicode_bidi16,76016,738
unicode_linebreak76,54076,572
unicode_properties00
unicode_script00
unicode_segmentation4,2564,050
v7_core1,6961,696
v7_gpu_d3d114,4964,496
v7_platform_windows18,35518,531
v7_text38,25648,544
v7_vt10,12010,098
voyager731,72832,112

Zero means no separately identifiable symbol interval, not proof that a dependency has no linked code. Generic/runtime and anonymous buckets contain additional shared code and tables. Ghostty Unicode is a lower bound on named tables; anonymous table bytes cannot be reliably divided between std, Unicode, and terminal code.

Throughput results

Each cell is decimal MB/s, median of three samples, in stream order. Initial baseline and candidate runs overlapped other work on this shared host. Repeat baselines demonstrate substantial scheduling noise; they cannot support a precise 5% acceptance claim. All raw per-sample nanoseconds are retained in build/w10.

Platform/configurationPlainSGRCJK/emojiCursor
Linux initial baseline248.0754.0990.2757.89
Linux ReleaseSmall, kitty off200.5041.7555.8747.78
Linux ReleaseFast, kitty off, first run190.7341.5676.0646.89
Linux ReleaseFast, kitty off, repeat240.8548.91124.2571.21
Linux unchanged baseline, repeat192.9729.5852.0333.62
Linux final, repeat300.9947.8877.7751.78
Win7 initial baseline530.13101.19111.7259.66
Win7 ReleaseSmall, kitty off358.8438.4359.3941.80
Win7 final213.6845.7869.9646.08
Win7 unchanged baseline, repeat265.3149.7586.0659.68

ReleaseSmall loses 32–62% against the initial Win7 baseline, and substantially regresses Linux too; the smaller binary does not justify it. It is not retained. The retained feature removal plus Rust optimization is worthwhile for its roughly 894 KB saving, but the throughput gate remains unresolved, requiring the parent's decision. The final Win7 run is more than 5% slower than the initial baseline on all streams. Even the unchanged Win7 baseline fell from 530.13 to 265.31 MB/s on plain text and 101.19 to 49.75 on SGR. Linux baseline repeats also vary severely. This supports host/VM contention as a confounder, not a conclusion that the retained change is free of regression. A paired baseline/final run on an otherwise idle host is needed. Rust dependency s has not separately been benchmarked for shaping or rendering; the VT benchmark does not exercise those libraries.

Validation and remaining gate

  • nix develop -c cargo xtask size: passes, 3,074,048 / 5,000,000 bytes.
  • A saved baseline extended to 5,000,001 bytes fails with executable exceeds 5 MB.
  • nix develop -c cargo test -p xtask: 3 passed, including PE/map interval accounting, alias deduplication, zero-filled virtual bytes, attribution, and gate boundaries.
  • nix develop -c cargo test -p v7-vt --test corpus: 3 tests passed, including 46 fixtures.
  • nix develop -c cargo xtask lint: passes formatting and both Clippy target passes.
  • nix develop -c cargo xtask check-imports: passes. Final DLLs: kernel32, user32, gdi32, advapi32, d3d11, ntdll. No CRT and no forbidden known post-Win7 imports. Every benchmark exe executed on Win7 was also checked first.
  • cargo xtask vm-smoke reached Win7: 46 replays plus --smoke passed with the final 3,074,048-byte executable. I stopped that invocation after recognizing it uses the shared w7 guest directory; subsequent commands used the assigned C:\v7\w10 directory.
  • An equivalent smoke/replay runner in C:\v7\w10 passed Win10: 46 replays plus smoke.
  • The existing four-case xtask/src/render.rs WARP harness, compiled as a temporary host runner with only its guest directory changed to w10 and its domain restricted to Win10, passed 4/4 (dimensions, background, foreground, blank cells). It reports one draw call, zero paint allocations, and no missing clusters for these fixtures.
  • The full standard cargo xtask vm-render was not verified on both VMs. Win7's guest agent disconnected before the final render run and throughput repeat: Guest agent is not responding: QEMU guest agent is not connected. No VM restart was attempted; the brief reserves that to the owner.

The owner must restore the Win7 guest agent, rerun final WARP checks, and settle the 5% throughput gate with controlled paired measurements before treating this as a release-ready reduction. The no-kitty build should also have a future feature-gate contract test when kitty graphics becomes part of the product's test corpus.

Ownership handoff: the benchmark dev dependency causes Cargo to add v7-platform-windows to v7-vt's Cargo.lock dependency list. Cargo.lock was not an owned file, so that generated entry was removed after verification; the parent must regenerate/retain it when integrating. Other agents' lockfile changes remain intact.

Paired rerun and decision (parent, 2026-11-06)

The only change that touches VT parsing is patch 0004 (kitty graphics off); the opt-level = "s" override applies to external Rust crates (fonts and shaping), not libghostty-vt. Linux builds with kitty on and off ran in eight interleaved rounds, pinned to one core, on a host loaded by unrelated work (load average about 15 on 12 cores). Per round the best of three samples was kept; the table is the median over the rounds, decimal MB/s.

StreamKitty onKitty offChange
Plain304.3304.7+0.1%
SGR58.556.4-3.6%
CJK/emoji113.6102.5-9.8%
Cursor73.179.3+8.4%

Differences go both ways and sit inside the run-to-run spread (the fastest single samples favor kitty off on three of four streams). Decision: no measurable VT regression; the 538 KB saving is kept. The s override is kept too, but shaping and rasterization speed are not measured yet; re-check it with the Renderer benchmark once one exists, and revert it if shaping regresses beyond 5%. A quiet-host rerun on Windows 7 is still worth doing when the VM is free.

Size hunt (2026-11-27)

Splits, search and the small actions brought standalone-min (voyager7.exe plus its appended hook DLL) to 4,946,476 of 5,000,000 bytes. These changes cut it without removing features. Each saving was measured on its own; the exe is what cargo xtask size reports.

Changevoyager7.exestandalone-min
Before (main 4a225fc)4,809,7284,946,476
swash resolves skrifa 0.40, as cosmic-text does (one font stack)-99,840
Patch 0008: function/data sections in the static lib-vt-354,816
v7-platform-windows, v7-core, v7-tab-strip at opt-level s-114,688
Hook DLL appended zlib-compressed (V7HOOK02)+512-72,028
Patch 0009: lib-vt logs below error compiled out in release-132,096
After4,108,8004,173,520
  • One font stack. swash 0.2.10 accepts skrifa >=0.31.1, <=0.44, so Cargo can give it the skrifa 0.40 / read-fonts 0.37 that cosmic-text and harfrust already use; the earlier note that the versions could not be unified was wrong. 288,532 glyph rasters (seven fonts, hinted and unhinted, two weights, seven sizes) hash identically with both lockfiles. Keep swash's skrifa on cosmic-text's version when either is bumped.
  • Function sections. Zig emitted the static lib-vt as one .text/.rdata section, so lld kept every exported C API function and all it reaches. Code generation is unchanged; the link now drops unreferenced sections.
  • Logs. Voyager7 installs no ghostty_sys_set log callback, so warn/info/debug messages were formatted for nobody inside the stream handlers.
  • Cold crates at s. Win7 first-frame time (--replay --render, 24 rounds) did not move with s; the same crates at z were 8-14% slower, so they stay at s.
  • Hook overlay. The trailer hash is of the inflated DLL, so the cache directory for a given DLL keeps its name. The exe inflates and verifies before using it.

VT throughput (throughput example, best of three per run, median of runs) with patches 0008 and 0009 against 0001-0007 alone, MB/s:

PlatformPlainSGRCJK/emojiCursor
Linux, 8 rounds283.5 → 283.290.8 → 96.7151.4 → 154.4107.6 → 114.5
Win7, 5 rounds253.0 → 263.092.2 → 92.6132.0 → 131.8100.1 → 106.1
Win10, 5 rounds222.2 → 226.960.3 → 61.6112.3 → 113.669.7 → 73.0

--render-burst row-miss cost (µs per shaped row) and --replay --render first-frame time stayed within run-to-run noise on Win7 and Win10, and the rendered bitmaps were byte-identical to main's.

Measured and rejected:

  • External dependencies at z instead of s (-76 KB): host shaping of mixed Latin/Arabic/box rows 35-45% slower, rasterization 20-40% slower, Win10 first frame about 30% slower.
  • v7-text at s (-45 KB): shaping about 6% slower on the host, about 3.5% in the Win10 row-miss benchmark. It is a hot crate.
  • lld identical code folding: already on by default in lld-link; no change.
  • log crate release_max_level_off for fontdb/cosmic-text: no saving.

Not done; these need a decision:

  • voyager7 at s (-232 KB). The row-miss and first-frame benchmarks didn't move, but the binary crate's opt-level sets the fat-LTO pipeline for the whole program: -Os everywhere and no loop vectorization in any Rust crate, including the Win7 scraper, which has no quick throughput benchmark.
  • -glyph_protocol in the lib-vt features (-47 KB). Voyager7 doesn't render registered glyphs, yet lib-vt answers the support query and accepts registrations. Turning it off would stop that reply, which changes what TUIs see.
  • lib-vt error logs as well (-23.5 KB), with a no-op log function.
  • v7-backend-conpty at s (-39 KB). It holds the ConPTY pump and the Win7 scraper.

The cargo xtask size attribution charges unnamed constants to the preceding named symbol. "unicode_linebreak" (about 157 KB) is really a 5.7 KB trie index followed by about 137 KB of anonymous Rust .rdata; its whole crate is about 21 KB.

Size pass: application crates (2026-11-30)

The kitty graphics and 2026-11-29 feature rounds took voyager7.exe to 5,397,504 bytes (main 6d4d6b3). Three agents cut it without removing features; this section is the Rust application part. Each saving was measured on its own.

Changevoyager7.exe
Before (main 6d4d6b3)5,397,504
Application code as the voyager7-app library at opt-level s-320,000
One shared sort for the settings, menu and CLI lists (v7_core::sort)-49,152
+boo frames stored by row before deflate-26,624
X11 colour table embedded deflated-10,240
Own decimal parser for configuration numbers (v7_core::number)0 (about -17 KB once ttf-parser is gone)
After4,991,488
  • The application is a library. The 2026-11-27 hunt left "voyager7 at s" undecided because the binary crate's opt-level is the one the whole-program LTO runs at: every Rust crate would lose loop vectorization. crates/voyager7 is now only the entry point and stays at 3; the application (the same sources, still in crates/voyager7/src) builds as voyager7-app at s. Functions keep the optimization level of the crate they come from, so v7-text, v7-vt, v7-gpu-d3d11 and the backends are compiled as before. +version reports the application crate's level, so its build mode line reads release (opt-level s).
  • Sorting. slice::sort_by compiles a complete sort, about 5 KB, for every element type. Twelve cold lists (themes, profiles, settings rows, fonts, toasts) now sort a list of indices with one copy of that code. v7-text's glyph sorts and v7-vt's per-frame placement sort are hot and keep the slice methods.
  • +boo. The 235 frames are stored as 42 row streams, each holding that row's line in every frame, with a one-byte marker for a line equal to the frame before. A row changes little between frames, so the same deflate packs it to 43,173 bytes instead of 70,956. The player rebuilds the frames; +boo output redirected to a file is byte-identical to main's on Win7 and Win10.
  • X11 colours. colors.txt (15,434 bytes) is embedded deflated (4,723 bytes) and unpacked only for +list-colors or to resolve a colour name. No name starts with #, holds : or is made of hex digits alone, so hex and rgb: values, which is every bundled theme, never unpack it.
  • Numbers. str::parse::<f32/f64> links core's general decimal conversion: a 10 KB table and about 7 KB of code. v7_core::number takes the same grammar and is exact for up to 15 significant digits within 10^±22; tests compare it with core bit for bit, including every f32 split ratio a session file can hold. ttf-parser's CFF reader was the other caller, so the saving appears only when ttf-parser is no longer linked.

Speed, base against this branch, 10 interleaved rounds per VM (offscreen WARP):

Win7 baseWin7 branchWin10 baseWin10 branch
First frame, 19-utf8-wide, median µs66,26057,83682,82479,486
First frame, 27-stress, median µs90,21777,61472,91970,006
--render-burst row miss, median µs24.5924.8648.8652.76
--render-burst row miss, best µs20.8123.5043.4943.41

The differences are inside the run-to-run spread of the shared host, and the rendered bitmaps are SHA-256-identical on both systems.

Measured and rejected:

  • voyager7-app at z (-91 KB more, 4,900,352): bitmaps identical and first frame unchanged, but the row-miss cost rose (Win7 median 24.59 → 29.62 µs, Win10 best 43.49 → 51.20 µs).
  • The binary crate itself at s (5,027,840 from the baseline, about 50 KB more than the library split): it changes code generation in every hot crate.

The diagnostic drivers the VM tests run were left for a decision here; see the next section.

VM test drivers out of packages (2026-12-01)

The --conpty-smoke driver (with its TUI stress, resilience, replay and selection stress loops) and the --scraper-* probes run only in the VM tests. They now build only with the vm-diagnostics feature of voyager7, which cargo xtask vm-smoke and cargo xtask vm-tui turn on (conpty-experiment implies it), and cargo xtask lint checks. Packages leave it off. Without it, either flag exits with code 87 at once instead of opening a window. --smoke, --replay, --render-burst, --list-fonts and --diag-profiles stay in every build: the render, font and package tests run them on the packaged exe.

voyager7.exestandalone-min
Before (main 891ced4)4,935,1684,999,903
After4,870,1444,934,879

The cost of this is the one named in the decision: the VM smoke and TUI tests run a build with these drivers added, not the byte-identical package. Everything else in that build is the same code.