Files
zeekayandHanzo Dev 4fdedc5f54 Every benchmark in one repository
The measurement lanes lived in hanzoai/cloud/bench, which meant cloning the
thing being measured to run anything — including lanes that measure no binary
at all. They are here now, at the root, beside the load and scale harnesses
that were already here: eleven lanes, MEASURED.md for what each found,
naive.md for what competitors publish and where it was read.

Four lanes still need the cloud source, because they measure a binary rather
than a library. `cloud_src` in host.sh finds it — $CLOUD_SRC, then ../cloud —
or prints how to get one. It does not clone: a benchmark that fetches its own
subject decides which revision you measured.

AND IT SAYS WHICH SOURCE IT FOUND. hanzoai/cloud and hanzo-inc/cloud are
different repositories that both check out as `cloud`, and self/modules.sh
reads 127 modules on one and 55 on the other. Neither is wrong about the tree
it was handed; a lane that does not name its subject is. It prints path, remote
and commit now, the way every timing prints its host.

Fixed on the way: egress reached for bench/egress/catcher.py and transport for
./bench/transport/harness, both paths in the repository they left. The harness
builds from this module now — its only dependency is zap-proto/zip — and
market/bench.mjs and brain/tables.mjs lost a directory level each.

Verified from the new root: fleet reproduces 454.6 MB and 477 bytes per agent,
and self/modules.sh reproduces 127 of 127 when pointed at the tree the figure
came from.

Co-authored-by: Hanzo Dev <[email protected]>
2026-09-16 09:51:20 -07:00

76 lines
3.5 KiB
JavaScript

/**
* The platform lanes, as data.
*
* The lanes that measure the software itself — whether you can have it, whether
* it tells anyone, what is on the disk, what a call costs — printed to a
* terminal and reached no further. This runs them and writes what they said.
*
* Nothing is typed in here: each lane emits its own rows through `say` (or, for
* the transports harness, `-json`), so a rerun that changes a number changes this
* file, and a lane that fails leaves its section out rather than a stale one in.
*
* node platform.mjs # runs every lane, writes benchmarks-platform.json
* node platform.mjs self transports # just those
*
* Four of the five build the cloud binary, so they need its source: see
* `cloud_src` in host.sh. Without it they resolve to whatever checkout is next
* door, which may be a different repository that answers a different question.
*/
import { execFileSync } from 'node:child_process'
import { existsSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
const here = new URL('.', import.meta.url).pathname
const LANES = [
{ lane: 'self', script: 'self/run.sh', title: 'Ownership — building and serving it yourself' },
{ lane: 'modules', script: 'self/modules.sh', title: 'Ownership — can anyone fetch what it is built from' },
{ lane: 'egress', script: 'egress/run.sh', title: 'Privacy — what leaves the machine' },
{ lane: 'cipher', script: 'cipher/run.sh', title: 'At rest — what is on the disk' },
{ lane: 'transports', script: 'transport/run.sh', title: 'The per-call tax, per transport' },
]
const want = process.argv.slice(2)
const lanes = want.length ? LANES.filter((l) => want.includes(l.lane)) : LANES
const dir = mkdtempSync(join(tmpdir(), 'bench-platform-'))
const sections = []
let host = ''
for (const l of lanes) {
const out = join(dir, `${l.lane}.json`)
process.stderr.write(`— ${l.lane}\n`)
let text = ''
try {
text = execFileSync('bash', [join(here, l.script)], {
encoding: 'utf8',
env: { ...process.env, BENCH_JSON: out },
stdio: ['ignore', 'pipe', 'inherit'],
maxBuffer: 1 << 24,
})
} catch (e) {
// A lane that fails says so and contributes nothing. A section carried over
// from a previous run would be the one thing worse than an absent one.
//
// AND IT SAYS WHY. "failed; leaving it out" was the whole report, so four
// lanes failing for one fixable reason — the cloud source resolving to a
// different repository — looked like four unrelated breakages and named
// none of them. The lane's own last words are the diagnosis.
const said = [e.stderr, e.stdout].map((x) => (x || '').toString().trim()).filter(Boolean).join('\n')
const why = said.split('\n').filter((x) => !/^ld: warning/.test(x)).slice(-1)[0] || e.message
process.stderr.write(` ${l.lane} failed; leaving it out — ${why.slice(0, 160)}\n`)
continue
}
const line = text.split('\n').find((x) => x.startsWith('host: '))
if (line && !host) host = line.slice('host: '.length).trim()
if (!existsSync(out)) continue
const rows = JSON.parse(readFileSync(out, 'utf8'))
sections.push({ lane: l.lane, title: l.title, rows })
}
rmSync(dir, { recursive: true, force: true })
const path = join(here, 'benchmarks-platform.json')
writeFileSync(path, JSON.stringify({ generated: new Date().toISOString(), host, sections }, null, 1) + '\n')
process.stderr.write(`\n${path}: ${sections.length} lanes\n`)