mirror of
https://github.com/hanzo-apps/hanzo.ai.git
synced 2026-10-30 14:58:08 +00:00
The index, its boards and the shelf's pages wrap their prose: server pages with <T>, the boards and the library with t(), and copy held in data with phrase(). Figures read from the runs are values, and the fields lib/kai, lib/tools, lib/coding and lib/tally hand a board are drawn through t(), so they translate once those files emit keys. The shared parts (Chapter, Fold, Stat, Tile, Panel, Mark) translate a string where they draw it and take a node from a server page. figures.spec lets the index import @hanzo/i18n: words in, words out, never a figure.
107 lines
4.3 KiB
TypeScript
107 lines
4.3 KiB
TypeScript
/**
|
||
* /benchmarks/sandbox — time to a running sandbox, by primitive.
|
||
*
|
||
* The table renders the sandbox pass of lib/data/benchmarks-runtime.json: each
|
||
* primitive with a Hanzo figure that no figure published beside it beats.
|
||
*/
|
||
import { phrase } from '@hanzo/i18n'
|
||
import { T } from '@hanzo/i18n/react'
|
||
import { pageMeta } from '@/lib/page-meta'
|
||
import { BENCHMARKS, bench } from '@/lib/benchmarks'
|
||
import { BenchJsonLd } from '@/components/benchmarks/JsonLd'
|
||
import { Grid, H2, Meta, More, Note, P, Shell, Spec, type Col } from '@/components/benchmarks/kit'
|
||
import { RUNTIME, shots, type Shot } from '@/lib/bench-data'
|
||
|
||
const B = bench('sandbox')!
|
||
|
||
export const metadata = pageMeta({
|
||
title: 'Sandbox cold start benchmark',
|
||
description:
|
||
'Time to a running sandbox: a V8 context ready to execute JavaScript in 0.13 ms, the median of one pass, reproducible by one command.',
|
||
path: '/benchmarks/sandbox',
|
||
})
|
||
|
||
const MEASURES = ['context start latency']
|
||
|
||
/* What each primitive can RUN is particular to this page, so it is joined on
|
||
here rather than carried in the shared rows. */
|
||
const RUNS: Record<string, string> = {
|
||
'V8 context': phrase('JavaScript, sharing the heap'),
|
||
}
|
||
/* The primitives shown: each a Hanzo measurement that no figure published beside it beats (lib/bench-data). */
|
||
const ROWS = shots('sandbox')
|
||
const cols: Col<Shot>[] = [
|
||
{ head: <T>primitive</T>, get: (r) => r.what, left: true },
|
||
{ head: <T>measured here</T>, get: (r) => r.ours },
|
||
{ head: <T>what it can run</T>, get: (r) => (RUNS[r.what] ? <T>{RUNS[r.what]}</T> : '–'), left: true },
|
||
]
|
||
|
||
export default function Page() {
|
||
return (
|
||
<>
|
||
<BenchJsonLd b={B} measures={MEASURES} />
|
||
<Shell b={B}>
|
||
<Spec b={B} />
|
||
|
||
<H2><T>What is measured</T></H2>
|
||
<P>
|
||
<T>{'The time from asking for a sandbox to having one that will execute code. A V8 context is a fresh global inside a V8 isolate that is already running: it is cheap because it shares that isolate’s heap. Timings are the median of the pass.'}</T>
|
||
</P>
|
||
|
||
<H2><T>Results</T></H2>
|
||
<Meta>
|
||
<T values={{ machine: RUNTIME.passes.sandbox.machine }}>{'{machine} · the pass of 2026-09-07 · median of the pass'}</T>
|
||
</Meta>
|
||
<Grid cols={cols} rows={ROWS} keyOf={(r) => r.what} />
|
||
<Note>
|
||
<T>{'A context runs JavaScript, which makes it the right primitive for a JavaScript transform. An agent that installs a package or runs a shell gets a microVM instead, which is a separate measurement.'}</T>
|
||
</Note>
|
||
|
||
<H2><T>What this measures, and what it does not</T></H2>
|
||
<P>
|
||
<strong>
|
||
<T>Cold start is not throughput.</T>
|
||
</strong>{' '}
|
||
<T>
|
||
{'This is the time to the first instruction, on an idle machine. It says nothing about what happens when a thousand sandboxes are asked for at once.'}
|
||
</T>
|
||
</P>
|
||
<P>
|
||
<strong>
|
||
<T>One machine, one day.</T>
|
||
</strong>{' '}
|
||
<T>
|
||
{'A single pass on one laptop, reproducible by one command. Read it as a floor that has been established rather than as a service level.'}
|
||
</T>
|
||
</P>
|
||
<P>
|
||
<strong>
|
||
<T>It is one of three costs, not the cost.</T>
|
||
</strong>{' '}
|
||
<T
|
||
values={{
|
||
dormant: <a href="/benchmarks/fleet"><T>477 bytes and a 0.034 ms resume</T></a>,
|
||
live: <a href="/benchmarks/goroutine"><T>601 bytes of heap and 125 ns to spawn</T></a>,
|
||
}}
|
||
>
|
||
{'A sandbox is what an agent needs to run a command. What it costs to keep an agent that is doing nothing is {dormant}, and what a running agent holds is {live}. The three are separate measurements with separate commands and they do not add up into a single number.'}
|
||
</T>
|
||
</P>
|
||
|
||
<More b={B} all={BENCHMARKS} />
|
||
<Meta>
|
||
<T
|
||
values={{
|
||
harness: <a href={B.harness.url}>{B.harness.repo}</a>,
|
||
script: <code>sandbox.mjs</code>,
|
||
start: <code>colima start</code>,
|
||
}}
|
||
>
|
||
{'harness and the committed table: {harness} · {script} needs a container runtime; {start} is enough on macOS'}
|
||
</T>
|
||
</Meta>
|
||
</Shell>
|
||
</>
|
||
)
|
||
}
|