Artifactspublic-v0

ply

main
ply4 git calls430 ms44 KiB2 cachedprotocol v2
399 lines22 KiBRaw
1// One memory cell of test/stream-memory.test.js, in its own process (test/memcell.js's flags, and the heap the parent
2// picks). The input is generated as it is read by the plain iterators of test/stream/pieces.mjs, which keep no piece once
3// it is handed over (a generator's frame does on node 22: #249), so the cell measures what ply holds. After a gc at
4// every sample point (array buffers swept with it, not on a background thread), the peak of process.memoryUsage().arrayBuffers over the cell, less the value before it,
5// is the bytes the code under test kept alive (Uint8Arrays sit outside the V8 heap --max-old-space-size caps). One
6// JSON line on stdout.
7//
8// inflate-drop a stored zlib member of SIZE bytes, every chunk dropped bound: peakBound(inflate)
9// scan-drop a pack of COUNT 1-byte blobs, scanned, every object dropped bound: peakBound(pack-scan)
10// scan-work a pack of 3 x SIZE stored blobs of SIZE/1 MiB chunks under WORK_BUDGET, default caps, every chunk dropped bound: peakBound(pack-scan)
11// scan-index scanPackIndex of a pack of COUNT 1-byte blobs, oids on bound: peakBound(pack-scan) + its columns
12// scan-index-big scanPackIndex of 3 x SIZE stored blobs, default caps, oids on bound: peakBound(pack-scan)
13// scan-iter scanPack (#241) of 3 x SIZE stored blobs under WORK_BUDGET, every piece dropped bound: peakBound(pack-scan)
14// inflate-iter inflateChunks (#241) of a SIZE-byte stored member from a ReadableStream bound: peakBound(inflate)
15// pkt-iter pktFrames (#241) of SIZE max-size data frames, every frame dropped bound: peakBound(pkt)
16// fetch-object fetchObject of a SIZE-byte blob through the http transport (fetchSingle) bound: peakBound(fetch-object)
17// fetch-drain the same response with every pack chunk dropped: the transport's own share
18// fetch-buffered the same bytes read the way fetchSingle did before #172: the zlib member collected, then inflate()
19// inflate-whole inflate() of a SIZE-byte stored member in hand, with its declared size bound: SIZE + peakBound(inflate)
20// inflate-capped the same without a declared size (the output buffer grows)
21// fetch-wide fetchObject of a tree through the blob:none fallback (fetchWide): a pack of COUNT 4 KiB trees, every
22// one retained (checked and harvested) bound: peakBound(fetch-pack, R)
23// fetch-wide-blobs the same through the unfiltered fallback, the pack also holding COUNT/32 256 KiB blobs the tree want
24// does not need (R is the trees)
25// fetch-pack fetchPack of the fetch-wide pack (fetchPackOnce, every object parsed and resolved) bound: peakBound(fetch-pack, R)
26import crypto from 'node:crypto';
27import { source, END, seq, once, repeat, sealed, chunked, framed, asAsync, drain } from './pieces.mjs';
28import { inflateInit, inflateFeed, inflatePull, inflateEnd, declaredBound, zlibWrap } from '../../src/inflatestream.js';
29import { inflate } from '../../src/inflate.js';
30import { parsePackInit, parsePackFeed, parsePackPull, parsePackEnd, packScanOpts, WORK_BUDGET } from '../../src/packstream.js';
31import { fetchObject, packStream, spInit, spStep, spFinish } from '../../src/fetch.js';
32import { fetchPack } from '../../src/fetchpack.js';
33import zlib from 'node:zlib';
34import { createTransport } from '../../src/http.js';
35import { encodeObjHeader } from '../../src/pack.js';
36import { concat } from '../../src/bytes.js';
37import { TYPE } from '../../src/objects.js';
38import { Tracer } from '../../src/otel.js';
39import { withLimits, DEFAULT_LIMITS, LIMIT_OBJECT_OVERHEAD } from '../../src/limits.js';
40import { peakBound } from '../../src/streambound.js';
41import { PACK_SIGNATURE, PACK_VERSION, PACK_HEADER_BYTES, PKT_MAX_PAYLOAD } from '../../src/format.js';
43const [mode, sizeArg] = process.argv.slice(2);
44const SIZE = Number(sizeArg);
45const STORED = 65_535;
46const FEED = 16_384;
47const ADLER_MOD = 65_521;
49// Samples inside synchronous code too: every SAMPLE_BYTES of new Uint8Arrays (a buffer, not a view) the code under test
50// allocates, a sample (gc, then the live arrayBuffers). Without it a cell sees only the points where its input generator
51// runs, and a parse that joins the pack after the stream ended peaks between them. ply reads the global `Uint8Array` at
52// call time, so the subclass sees its allocations; instanceof still answers for every Uint8Array.
53const SAMPLE_BYTES = 256 * 1024;
54const NativeU8 = globalThis.Uint8Array;
55let measuring = false, sampling = false, allocated = 0;
56class SampledU8 extends NativeU8 {
57 constructor(...args) {
58 super(...args);
59 if (measuring && !sampling && typeof args[0] === 'number') {
60 allocated += args[0];
61 if (allocated >= SAMPLE_BYTES) { allocated = 0; sampling = true; note(); sampling = false; }
62 }
63 }
64 static [Symbol.hasInstance](v) { return v instanceof NativeU8; }
66globalThis.Uint8Array = SampledU8;
68const must = r => { if (r.ok) return r.value; throw new Error(`${r.error.code}: ${r.error.message}`); };
69function ab() { global.gc(); global.gc(); return process.memoryUsage().arrayBuffers; }
70let base = 0;
71let peak = 0;
72const note = () => { const a = ab(); if (a > peak) peak = a; };
73function start() { base = ab(); peak = base; measuring = true; }
75// The blob's bytes from `at`, n of them, in pieces of at most FEED bytes (as a transport hands a body over): a
76// pattern, so nothing has to be kept to know them, and the source holds no piece.
77function blobBytes(at, n) {
78 let off = 0;
79 return source(() => {
80 if (off >= n) return END;
81 const piece = new Uint8Array(Math.min(FEED, n - off));
82 for (let i = 0; i < piece.length; i++) { const k = at + off + i; piece[i] = k * 31 + (k >> 9); }
83 off += piece.length;
84 return piece;
85 });
87// A zlib member of stored blocks over the blob, with its Adler-32, generated as it is read.
88function storedMember(size) {
89 let a = 1, b = 0;
90 const adler = piece => { for (let i = 0; i < piece.length; i++) { a = (a + piece[i]) % ADLER_MOD; b = (b + a) % ADLER_MOD; } return piece; };
91 const blocks = Math.ceil(size / STORED);
92 const block = j => {
93 const at = j * STORED, n = Math.min(STORED, size - at), nlen = (~n) & 0xffff;
94 const bytes = blobBytes(at, n);
95 return seq([() => once(Uint8Array.of(at + n === size ? 1 : 0, n & 0xff, n >> 8, nlen & 0xff, nlen >> 8)), () => source(() => { const r = bytes.next(); return r.done ? END : adler(r.value); })]);
96 };
97 const tail = () => { const t = new Uint8Array(4); new DataView(t.buffer).setUint32(0, ((b << 16) | a) >>> 0); return once(t); };
98 return seq([
99 () => once(Uint8Array.of(0x78, 0x01)),
100 ...(size === 0 ? [() => once(Uint8Array.of(1, 0, 0, 0xff, 0xff))] : []),
101 () => repeat(blocks, block),
102 tail,
103 ]);
105const packHead = count => { const h = new Uint8Array(PACK_HEADER_BYTES); h.set(PACK_SIGNATURE); new DataView(h.buffer).setUint32(4, PACK_VERSION); new DataView(h.buffer).setUint32(8, count); return h; };
106function blobOid(size) {
107 const h = crypto.createHash('sha1').update(`blob ${size}\0`);
108 for (const b of blobBytes(0, size)) h.update(b);
109 return h.digest('hex');
112function inflateDrop() {
113 start();
114 const st = must(inflateInit({ bound: declaredBound(SIZE), wrap: zlibWrap(true) }));
115 let produced = 0, blocks = 0;
116 const drain = end => {
117 for (;;) {
118 const p = must(end ? inflateEnd(st) : inflatePull(st));
119 if (p.kind === 'chunk') { produced += p.bytes.length; continue; }
120 return p.kind;
121 }
122 };
123 for (const piece of storedMember(SIZE)) {
124 inflateFeed(st, piece);
125 drain(false);
126 if (++blocks % 64 === 0) note();
127 }
128 if (drain(true) !== 'end' || produced !== SIZE) throw new Error(`inflated ${produced} of ${SIZE}`);
129 note();
130 return { bound: peakBound({ kind: 'inflate' }), produced };
133function scanDrop() {
134 const count = SIZE;
135 const one = concat([encodeObjHeader(TYPE.BLOB, 1), Uint8Array.of(0x78, 0x01, 1, 1, 0, 0xfe, 0xff, 7, 0, 8, 0, 8)]);
136 const limits = withLimits({ maxPackObjects: count, maxInflatedTotal: count * (1 + LIMIT_OBJECT_OVERHEAD) });
137 start();
138 const st = must(parsePackInit(packScanOpts(limits)));
139 let objects = 0, fed = 0;
140 const body = () => seq([() => once(packHead(count)), () => repeat(count, () => once(one))]);
141 for (const piece of sealed(body())) {
142 parsePackFeed(st, piece);
143 for (;;) {
144 const p = must(parsePackPull(st));
145 if (p.kind === 'need') break;
146 if (p.kind === 'object-end') objects += 1;
147 }
148 if (++fed % 5000 === 0) note();
149 }
150 for (let p = must(parsePackEnd(st)); p.kind !== 'end'; p = must(parsePackPull(st))) { /* the trailer */ }
151 note();
152 if (objects !== count) throw new Error(`scanned ${objects} of ${count}`);
153 return { bound: peakBound({ kind: 'pack-scan' }), objects };
156// A pack past every default cap: three blobs of SIZE, each over maxObjectSize, their total over maxInflatedTotal.
157function scanWork() {
158 const count = 3;
159 start();
160 const st = must(parsePackInit(packScanOpts(DEFAULT_LIMITS, false, WORK_BUDGET)));
161 let objects = 0, inflated = 0, fed = 0;
162 const body = () => bigPack(count, SIZE);
163 // in its own function, as inflateDrop: a piece left in this frame's variables is the cell's memory, not the scan's
164 const drain = () => {
165 for (;;) {
166 const p = must(parsePackPull(st));
167 if (p.kind === 'need') return;
168 if (p.kind === 'chunk') inflated += p.bytes.length;
169 if (p.kind === 'object-end') objects += 1;
170 }
171 };
172 for (const piece of sealed(body())) {
173 parsePackFeed(st, piece);
174 drain();
175 if (++fed % 64 === 0) note();
176 }
177 for (let p = must(parsePackEnd(st)); p.kind !== 'end'; p = must(parsePackPull(st))) { /* the trailer */ }
178 note();
179 if (objects !== count || inflated !== count * SIZE) throw new Error(`scanned ${objects} objects, ${inflated} bytes`);
180 return { bound: peakBound({ kind: 'pack-scan' }), objects, inflated };
183// A pack of `count` stored blobs of `size` bytes, generated as it is read (no trailer: sealed() adds it).
184const bigPack = (count, size) => seq([() => once(packHead(count)), () => repeat(count, () => seq([() => once(encodeObjHeader(TYPE.BLOB, size)), () => storedMember(size)]))]);
185// A source that samples every `every` pieces it hands over.
186function sampledFeed(src, every) { let fed = 0; return source(() => { const n = src.next(); if (n.done) return END; if (++fed % every === 0) note(); return n.value; }); }
187// scanPackIndex (#236) of a pack of COUNT 1-byte blobs, oids on: the scan's hold plus the index's columns.
188async function scanIndexCell() {
189 const { scanPackIndex, SCAN_INDEX_ENTRY_BYTES } = await import('../../src/packscanindex.js');
190 const count = SIZE;
191 const one = concat([encodeObjHeader(TYPE.BLOB, 1), Uint8Array.of(0x78, 0x01, 1, 1, 0, 0xfe, 0xff, 7, 0, 8, 0, 8)]);
192 const limits = withLimits({ maxPackObjects: count });
193 start();
194 const src = sampledFeed(chunked(sealed(seq([() => once(packHead(count)), () => repeat(count, () => once(one))])), FEED), 256);
195 const t0 = performance.now();
196 const got = must(await scanPackIndex(asAsync(src), { limits, oids: true }));
197 const ms = performance.now() - t0;
198 note();
199 if (got.count !== count || got.columns.offset.length !== count) throw new Error(`indexed ${got.columns.offset.length} of ${count}`);
200 const keep = got.heldBytes;
201 return { bound: peakBound({ kind: 'pack-scan' }), objects: count, heldBytes: keep, perEntry: keep / count, entryBytes: SCAN_INDEX_ENTRY_BYTES, packBytes: got.bytes, ms };
203// scanPackIndex of three SIZE stored blobs, past every default cap, under its default WORK_BUDGET, oids on: the hold
204// stays the scan's whatever the pack's size.
205async function scanIndexBigCell() {
206 const { scanPackIndex } = await import('../../src/packscanindex.js');
207 const count = 3;
208 start();
209 const src = sampledFeed(sealed(bigPack(count, SIZE)), 64);
210 const t0 = performance.now();
211 const got = must(await scanPackIndex(asAsync(src), { oids: true }));
212 const ms = performance.now() - t0;
213 note();
214 const first = got.entry(0);
215 if (first.tag !== 'some' || first.value.oid !== blobOid(SIZE)) throw new Error('first blob oid differs from its hash');
216 return { bound: peakBound({ kind: 'pack-scan' }), objects: count, packBytes: got.bytes, heldBytes: got.heldBytes, ms };
219// scanPack (#241) over three SIZE stored blobs under WORK_BUDGET, every piece dropped: the adapter holds the scan's hold.
220async function scanIterCell() {
221 const { scanPack } = await import('../../src/pullstream.js');
222 const count = 3;
223 start();
224 const src = sampledFeed(sealed(bigPack(count, SIZE)), 64);
225 let objects = 0, inflated = 0;
226 await drain(scanPack(asAsync(src), { budget: WORK_BUDGET }), p => {
227 if (p.kind === 'chunk') inflated += p.bytes.length;
228 if (p.kind === 'object-end') objects += 1;
229 });
230 note();
231 if (objects !== count || inflated !== count * SIZE) throw new Error(`scanned ${objects} objects, ${inflated} bytes`);
232 return { bound: peakBound({ kind: 'pack-scan' }), objects, inflated };
234// inflateChunks (#241) of a SIZE-byte stored member, from a ReadableStream source, every chunk dropped.
235async function inflateIterCell() {
236 const { inflateChunks } = await import('../../src/pullstream.js');
237 start();
238 const src = sampledFeed(storedMember(SIZE), 64);
239 const stream = new ReadableStream({ pull(c) { const n = src.next(); if (n.done) c.close(); else c.enqueue(n.value); } }, { highWaterMark: 0 });
240 let produced = 0;
241 await drain(inflateChunks(stream, { bound: declaredBound(SIZE) }), chunk => { produced += chunk.length; });
242 note();
243 if (produced !== SIZE) throw new Error(`inflated ${produced} of ${SIZE}`);
244 return { bound: peakBound({ kind: 'inflate' }), produced };
246// pktFrames (#241) over SIZE max-size data frames made as they are read, every frame dropped: one chunk and one frame.
247async function pktIterCell() {
248 const { pktFrames } = await import('../../src/pullstream.js');
249 const room = PKT_MAX_PAYLOAD;
250 const te = new TextEncoder();
251 const frame = () => { const f = new Uint8Array(4 + room); f.set(te.encode((room + 4).toString(16).padStart(4, '0'))); return f; };
252 start();
253 const src = sampledFeed(repeat(SIZE, () => once(frame())), 16);
254 let frames = 0, bytes = 0;
255 await drain(pktFrames(asAsync(src)), f => { frames += 1; bytes += f.payload.length; });
256 note();
257 if (frames !== SIZE) throw new Error(`framed ${frames} of ${SIZE}`);
258 return { bound: peakBound({ kind: 'pkt' }), frames, bytes };
260// A v2 fetch response carrying the one-object pack, framed into band-1 pkt-lines as it is read.
261function responseStream(size) {
262 return frameStream(sealed(bigPack(1, size)));
264// The pieces of a pack framed into a v2 response body, sampled every 16 frames.
265function frameStream(pack) {
266 const frames = framed(pack, PKT_MAX_PAYLOAD - 1);
267 let n = 0;
268 return new ReadableStream({ pull(c) { const f = frames.next(); if (f.done) { c.close(); return; } if (++n % 16 === 0) note(); c.enqueue(f.value); } });
270function transport(size) {
271 const fetchImpl = async () => new Response(responseStream(size), { status: 200, headers: { 'content-type': 'application/x-git-upload-pack-result' } });
272 return must(createTransport('https://git.example/repo.git', { tracer: new Tracer(), fetchImpl, quirks: {} }));
274async function fetchStreamed() {
275 const oid = blobOid(SIZE);
276 const t = transport(SIZE);
277 start();
278 const got = must(await fetchObject(t, { oid, filter: '', expectType: TYPE.BLOB }));
279 note();
280 if (got.data.length !== SIZE) throw new Error(`fetched ${got.data.length}`);
281 return { bound: peakBound({ kind: 'fetch-object', output: SIZE }), oid };
283// The same response read through the transport and v2Step with every pack chunk dropped: what reading the response
284// costs before fetchSingle keeps anything (the generator's frame, the body chunk, the copied pkt payload).
285async function fetchDrain() {
286 const t = transport(SIZE);
287 start();
288 let bytes = 0;
289 for await (const chunk of packStream(t, { wants: ['0'.repeat(40)], filter: '' }, { set() {}, event() {}, error() {} })) bytes += chunk.length;
290 note();
291 return { bound: peakBound({ kind: 'sideband' }), bytes };
293// fetchSingle before #172: every zlib byte kept, joined, then inflated into a third buffer.
294async function fetchBuffered() {
295 const t = transport(SIZE);
296 start();
297 let sp = spInit();
298 const parts = [];
299 for await (const chunk of packStream(t, { wants: ['0'.repeat(40)], filter: '' }, { set() {}, event() {}, error() {} })) {
300 const r = must(spStep(sp, chunk));
301 sp = r.state;
302 parts.push(...r.zlib);
303 }
304 must(spFinish(sp));
305 const zlib = concat(parts);
306 note();
307 const out = must(inflate(zlib, 0, { expectedSize: sp.size }));
308 note();
309 if (out.out.length !== SIZE) throw new Error(`inflated ${out.out.length}`);
310 return { bound: peakBound({ kind: 'fetch-object', output: SIZE }), zlib: zlib.length };
313// inflate() of a member in hand: the input is the caller's (allocated before the cell starts), the output and what the
314// decoder holds are the cell's.
315// The member in one buffer, written piece by piece (no array of the pieces outlives the copy).
316function memberInHand(size) {
317 let n = 0;
318 for (const p of storedMember(size)) n += p.length;
319 const member = new Uint8Array(n);
320 let o = 0;
321 for (const p of storedMember(size)) { member.set(p, o); o += p.length; }
322 return member;
324function inflateWhole(declared) {
325 const member = memberInHand(SIZE);
326 start();
327 const out = must(inflate(member, 0, declared ? { expectedSize: SIZE } : {}));
328 note();
329 if (out.out.length !== SIZE) throw new Error(`inflated ${out.out.length}`);
330 return { bound: SIZE + peakBound({ kind: 'inflate' }), member: member.length };
333// COUNT trees of 128 entries (4,120 bytes each, distinct), and for `blobs` one 256 KiB blob per 32 trees: the pack's
334// pieces, each object's zlib member made as it is read. R is the trees' bytes, what a tree want retains.
335const TREE_ENTRIES = 128;
336function treeBytes(i) {
337 const te = new TextEncoder();
338 const parts = [];
339 for (let j = 0; j < TREE_ENTRIES; j++) {
340 parts.push(te.encode(`100644 f${String(j).padStart(3, '0')}\0`));
341 parts.push(new Uint8Array(crypto.createHash('sha1').update(`${i}/${j}`).digest()));
342 }
343 return concat(parts);
345const objHash = (type, data) => crypto.createHash('sha1').update(`${type} ${data.length}\0`).update(data).digest('hex');
346// The blobs' zlib members, made before a cell starts measuring (each 256 KiB blob compresses to a few hundred bytes), so
347// the generator never holds a blob.
348const BLOB = 256 * 1024;
349const blobMembers = n => Array.from({ length: n }, (_, i) => new Uint8Array(zlib.deflateSync(new Uint8Array(BLOB).map((_, k) => (k * 131 + i) & 255), { level: 9 })));
350function widePieces(count, blobs) {
351 const total = count + blobs.length;
352 const tree = i => { const t = treeBytes(i); return seq([() => once(encodeObjHeader(TYPE.TREE, t.length)), () => once(new Uint8Array(zlib.deflateSync(t)))]); };
353 const withBlob = i => (i % 32 === 31 && blobs.length > (i >> 5)) ? seq([() => tree(i), () => once(encodeObjHeader(TYPE.BLOB, BLOB)), () => once(blobs[i >> 5])]) : tree(i);
354 return seq([() => once(packHead(total)), () => repeat(count, withBlob)]);
356// A v2 response framing `pieces` (a pack, sealed here) into band-1 pkt-lines as it is read.
357const framedResponse = pieces => frameStream(sealed(pieces));
358async function fetchWideCell(withBlobs) {
359 const count = SIZE;
360 const blobs = withBlobs ? blobMembers(Math.floor(count / 32)) : [];
361 const want = objHash('tree', treeBytes(0));
362 const retained = count * treeBytes(0).length;
363 const fetchImpl = async () => new Response(framedResponse(widePieces(count, blobs)), { status: 200, headers: { 'content-type': 'application/x-git-upload-pack-result' } });
364 const t = must(createTransport('https://git.example/repo.git', { tracer: new Tracer(), fetchImpl, quirks: { treeFilter: withBlobs ? 'none' : 'blob:none' } }));
365 start();
366 const got = must(await fetchObject(t, { oid: want, filter: 'tree:0', expectType: TYPE.TREE }));
367 note();
368 if (got.oid !== want) throw new Error(`fetched ${got.oid}`);
369 return { bound: peakBound({ kind: 'fetch-pack', retained }), retained, harvested: t.objects.size, blobs: blobs.length };
371// The same response read through the transport and v2Step with every pack chunk dropped: the transport's own share.
372async function fetchWideDrain(withBlobs) {
373 const count = SIZE;
374 const blobs = withBlobs ? blobMembers(Math.floor(count / 32)) : [];
375 const fetchImpl = async () => new Response(framedResponse(widePieces(count, blobs)), { status: 200, headers: { 'content-type': 'application/x-git-upload-pack-result' } });
376 const t = must(createTransport('https://git.example/repo.git', { tracer: new Tracer(), fetchImpl, quirks: {} }));
377 start();
378 let bytes = 0;
379 for await (const chunk of packStream(t, { wants: ['0'.repeat(40)], filter: '' }, { set() {}, event() {}, error() {} })) bytes += chunk.length;
380 note();
381 return { bound: peakBound({ kind: 'sideband' }), bytes, blobs: blobs.length };
383async function fetchPackCell() {
384 const count = SIZE;
385 const retained = count * treeBytes(0).length;
386 const fetchImpl = async () => new Response(framedResponse(widePieces(count, [])), { status: 200, headers: { 'content-type': 'application/x-git-upload-pack-result' } });
387 const t = must(createTransport('https://git.example/repo.git', { tracer: new Tracer(), fetchImpl, quirks: {} }));
388 start();
389 const got = must(await fetchPack(t, { wants: [objHash('tree', treeBytes(0))], filter: '' }));
390 note();
391 if (got.objects.size !== count) throw new Error(`fetched ${got.objects.size}`);
392 return { bound: peakBound({ kind: 'fetch-pack', retained }), retained, objects: got.objects.size };
395const run = { 'inflate-whole': () => inflateWhole(true), 'inflate-capped': () => inflateWhole(false), 'fetch-wide': () => fetchWideCell(false), 'fetch-wide-blobs': () => fetchWideCell(true), 'fetch-wide-drain': () => fetchWideDrain(false), 'fetch-wide-blobs-drain': () => fetchWideDrain(true), 'fetch-pack': fetchPackCell, 'inflate-drop': inflateDrop, 'scan-drop': scanDrop, 'scan-work': scanWork, 'scan-index': scanIndexCell, 'scan-index-big': scanIndexBigCell, 'scan-iter': scanIterCell, 'inflate-iter': inflateIterCell, 'pkt-iter': pktIterCell,'fetch-object': fetchStreamed, 'fetch-drain': fetchDrain, 'fetch-buffered': fetchBuffered }[mode];
396if (!run) throw new Error(`unknown mode ${mode}`);
397const report = await run();
398const m = process.memoryUsage();
399console.log(JSON.stringify({ mode, size: SIZE, abDelta: peak - base, ...report, rss: m.rss, heap: m.heapUsed }));
Diagnostics4 git calls · 430 ms
CallStatusSizeTime0430 ms
discover200152 B4 ms
git.upload-pack discover
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=2
git.response.bytes=152
git.server.agent=gitty/1.0
git.server.object_format=sha1
git.server.caps=agent ls-refs fetch object-format
git.server.fetch=shallow filter sideband-all
git.protocol.version=2
git.pkt.frames=8
git.pkt.data=6
git.pkt.flush=2
git.pkt.delim=0
git.pkt.bytes=152
git.pkt.payload.max=34
ls-refs200145 B · hit3 ms
git.upload-pack ls-refs
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
git.upstream.dur_ms=3
git.response.bytes=145
git.response.cache=HIT
git.response.duration_ms=3
git.protocol.version=2
git.pkt.frames=3
git.pkt.data=2
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=145
git.pkt.payload.max=76
git.ls_refs.count=2
git.ls_refs.head=refs/heads/main
fetchblob:none · deepen 1020038 KiB · hit2 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=424
git.response.bytes=38434
git.response.cache=HIT
git.response.duration_ms=2
git.fetch.filter=blob:none
git.fetch.filter.requested=tree:0
git.fetch.filter.fallback=blob:none
git.fetch.filter.learned=false
git.fetch.wants=19912563f540228593df0c489082e5e2508e21e4
git.fetch.haves.count=0
git.fetch.deepen=10
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=6
git.pkt.data=4
git.pkt.flush=1
git.pkt.delim=1
git.pkt.bytes=38434
git.pkt.payload.max=38339
git.sideband.band1.bytes=38338
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=63
git.pack.bytes=38338
git.pack.ofs_delta=0
git.pack.ref_delta=8
git.pack.chain.max=8
git.pack.trailer=0bc36ab7adf82d3109177f11f1ea93f1ce071f77
git.pack.full=55
Open pack map
fetch2006.5 KiB424 ms
git.upload-pack fetch
http.response.status_code=200
git.response.bytes=6676
git.response.cache=MISS
git.response.duration_ms=424
git.fetch.wants=f9cdaa07d8425c1c602784b417d59f0725f8fe1d
git.fetch.haves.count=0
git.fetch.deepen=0
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=3
git.pkt.data=2
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=6676
git.pkt.payload.max=6655
git.sideband.band1.bytes=6654
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0

Each row is one HTTP round trip ply made to the git server for this page, on one timeline. discover asks what the server speaks, ls-refs lists branch tips, fetch brings objects by id. A hit was served by Workers Cache. Tap a row for its wire details.

Remote
https://5ad2236b39de4c8bd8f6270ea63f3ea9.artifacts.cloudflare.net/git/public-v0/ply.git
Ref
refs/heads/main
Commit
19912563f540228593df0c489082e5e2508e21e4
cf-ray
a5e2bd48b84fcfc3
Request
3ae8f68f…
Protocol
v2 · sha1
Agent
gitty/1.0
Filter
advertised
Fetch
shallow filter sideband-all
Capabilities
agent ls-refs fetch object-format