/**
* transfer-2gb-blob — single 2 GB blob inside one dep.
*
* Stress test for raw bulk-transfer through NetworkFetcher:
* - One tree fetch (the dep's tree).
* - One content-fetch for a 2 GB file.
*
* This isolates "how fast does NetworkFetcher actually move bytes"
* from the per-tree-overhead dimension. Compare against
* transfer-2gb-many (same total bytes, many small files).
*
* History (pgh skill notes): hyper-deploy proven at 1.30 GB / 5.9 MB/s.
* We expect this to be slow today; the bench gives us a regression
* baseline before any streaming/chunking improvements land.
*
* NOTE: requires ~5 GB of free disk (2 GB fixture × 2 — staging + store).
* Won't run unless --enable-large is passed.
*/
import { publishFixture, installByName, clearStore } from './_lib.js'
const fixture = 'bench-blob-2g'
export const name = 'transfer-2gb-blob'
export const description = 'single 2 GB blob — bulk transfer through NetworkFetcher'
export async function setup (ctx) {
if (!process.argv.includes('--enable-large')) {
throw new Error('skipped (pass --enable-large to run)')
}
const { lockfile } = await publishFixture(ctx, fixture)
ctx._lockfile = lockfile
ctx.emit('fixture', fixture)
ctx.emit('payload_bytes', 2 * 1024 * 1024 * 1024)
}
export async function run (ctx) {
clearStore(ctx)
const t0 = Date.now()
await installByName(ctx, ctx._lockfile, fixture)
const elapsedSec = (Date.now() - t0) / 1000
ctx.emit('elapsed_sec', elapsedSec)
ctx.emit('throughput_mb_per_s',
Math.round((2 * 1024) / elapsedSec * 10) / 10)
}