~ knotless Search/
↑↓ move↵ open⇧↵ all results

zat.dev/zlay

atproto relay in zig · mirror of https://tangled.org/zat.dev/zlay

0
0
60 lines · 3.4 KB Raw History
# Relay build cost and executable size

The earlier paired samples below show build and executable-size costs at their
recorded revisions. They are historical measurements, not timings of the latest
source. Runtime behavior is covered separately in the [relay results](zkv-grouped-live.md).

| Measurement | zkv pilot | RocksDB control |
|---|---:|---:|
| Fresh-cache build | 91.55 s | 213.10 s |
| Unchanged rebuild | 0.201 s | 0.253 s |
| Strip-enabled rebuild | 30.38 s | 34.45 s |
| Default ELF file | 19,127,176 B | 164,043,096 B |
| Default ELF loadable file bytes | 4,214,404 B | 15,193,436 B |
| Strip-enabled ELF file | 3,996,456 B | 14,971,840 B |
| Strip-enabled ELF loadable file bytes | 3,994,508 B | 14,969,580 B |

Both builds use Zig 0.17.0, zio, ReleaseSafe, x86_64-linux-gnu and `-j2` on the
same Apple M5 Pro. Builds run sequentially from temporary source snapshots with
separate, initially empty local and global Zig caches. Dependencies are already
downloaded and shared read-only through the existing package directories;
`sandbox-exec` denies network access. OS filesystem caches are not cleared.
This is one sample per engine and phase, not a compile-time distribution or a
CI-host estimate. Strip-enabled rebuild time reuses the fresh build's caches;
it is not a second clean-build measurement.

Only the temporary build scripts change: the git subprocess becomes the same
captured short-SHA literal, and the relay module gains an optional strip flag.
The default measurement leaves stripping disabled. Stripped sizes come from an
actual strip-enabled Zig rebuild, not subtraction of debug-section sizes. An
earlier measurement script attempted `zig objcopy --strip-all`, which is
unimplemented in this compiler; its incomplete run is excluded.

ELF loadable bytes sum PT_LOAD file sizes. They do not measure page faults,
resident memory, heap use or per-connection overhead. `/usr/bin/time -l` build
resource observations are retained in each log; they should not be mistaken for
the relay's runtime memory consumption or an aggregate peak across simultaneous
compiler children. Default ELF size is dominated by debugging information,
especially for RocksDB's C++ dependency.

The [measurement script](../../../scripts/zkv/build_footprint.py) records exact source
revisions, source hashes including core zkv, flags, executable hashes and program
header sizes in [results.json](zkv-build-footprint-v2/results.json).
Fresh and unchanged build logs for
[zkv](zkv-build-footprint-v2/zkv-fresh-cache.log) and
[RocksDB](zkv-build-footprint-v2/rocks-fresh-cache.log) are retained alongside it.
Temporary sources, executables and compiler caches were deleted automatically.
No production build, deployment or upstream network request was performed.

## 2026-11-06 candidate

The normal stripped x86-64 Linux/zio ReleaseSafe relay at `244d209`, with zkv
`90f72c8`, is **4,067,912 bytes (3.88 MiB)**; loadable file bytes are 4,065,956.
Offline replay and stage profiling are disabled. The build reused existing
compiler/package caches; no fresh-cache timing comparison was repeated.
[Exact flags, source pins and binary hash](zkv-build-footprint-v2/2026-11-06-candidate.json).

The migration branch keeps RocksDB behind the opt-in `migration-tools` build
option, for the separate conversion executable. Normal relay builds do not
instantiate that dependency or link its C++ library. This is separate from
removing old production data, which requires the migration and rollback checks.