Jessedbrown Claude Fable 5 commited on
Commit
a509bdc
·
1 Parent(s): 61efe66

acer: preimage patch + quant huge-message bench sealed (operator approved)

Browse files

Two items. (1) Liris reproducibility catch conceded: the rebind digest row
ellipsized its components, so 77d4e16a... was not recomputable from
committed bytes. Patched by APPEND: FROZEN-SLICE-REBIND-PREIMAGE carries the
full 596-char preimage hex (hex form because the canonical string contains
pipe characters); sha256(hex-decoded) roundtrip verified = 77d4e16a....
(2) Quant huge-message benchmark sealed per liris's specced rows as RECEIPT
NOT CANON: 8-stage faithful-to-doctrine pipeline, 1MB-2GB curve (sha gain
62x->79303x, head flat ~1.9GB/s, raw 2GB crashes node sha256, retention
7-raw vs ~5M-tuples), QUANTLAW_DRAFT status DRAFT_UNTIL_LIRIS_RERUN_AND_
FIDELITY_SWEEP, QUANTGUARD names what is NOT proven. Rerunnable tool +
unit tests committed for the liris rerun.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

docs/ACER-QUANT-HUGE-MESSAGE-BENCH-2026-06-11.hbp ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ QUANTBENCHHDR|host=acer|date=2026-06-11|node=v24.13.1|cpu=Intel-Core-i5-8300H|mode=synthetic-faithful-8-stage|authority=OP-JESSE-apex-human-I-APPROVE-2026-06-11|lane=liris-specced-benchmark-receipt-NOT-canon-law|json=0
2
+ QUANTBENCHSCOPE|stages=JL+Turbo+Polar+Zeta+Triple+Quadruple+JS-histogram+von-Mangoldt|status=FAITHFUL_TO_DOCTRINE_NOT_FABRIC_ENGINE_BINDING|fabric_live_path=4-scalar-quants-per-PID-from-hashes-a-different-cheaper-animal|fidelity=UNSWEPT|json=0
3
+ QUANTBENCHRESULT|message=1MB|head_ms=1.3|sha_gain=62x|write_gain=2x|compare_gain=8x|payload=3.1KB|json=0
4
+ QUANTBENCHRESULT|message=8MB|head_ms=14.7|sha_gain=466x|write_gain=9x|compare_gain=43x|payload=3.1KB|json=0
5
+ QUANTBENCHRESULT|message=64MB|head_ms=25.2|sha_gain=4774x|write_gain=158x|compare_gain=166x|payload=3.1KB|json=0
6
+ QUANTBENCHRESULT|message=256MB|head_ms=123|sha_gain=10239x|write_gain=637x|compare_gain=210x|e2e_gain=8.1x|json=0
7
+ QUANTBENCHRESULT|message=1024MB|head_ms=574|sha_gain=66158x|write_gain=2881x|compare_gain=1781x|e2e_gain=6.8x|json=0
8
+ QUANTBENCHRESULT|message=2048MB|head_ms=1062|sha_gain=79303x|write_gain=4662x|compare_gain=1698x|e2e_gain=7.2x|ingest=1928MBps|json=0
9
+ QUANTBENCHHEADRATE|encode=1.8-to-2.1GBps-FLAT-from-256MB-to-2GB|meaning=head-tax-exactly-linear-never-degrades-while-tail-gains-grow-with-size|json=0
10
+ QUANTBENCHASYMPTOTE|quant_pipeline_ceiling=memory-scan-speed(~1.9GBps)|raw_pipeline_ceiling=disk-plus-hash-speed(~270MBps)|fanout=tail-gains-multiply-per-consumer-head-paid-once|json=0
11
+ QUANTBENCHAPILIMIT|finding=raw-2GB-message-CRASHED-node-single-shot-sha256(ERR_OUT_OF_RANGE-2^31)|forced=chunked-raw-path|quant_tuple=3.1KB-never-hits-API-limits|json=0
12
+ QUANTBENCHRETENTION|raw=~7-messages-of-2GB-fit-16GB-RAM|quant=~5M-tuples-fit-16GB-RAM|meaning=GC-envelope-economics-at-the-message-layer-keep-the-quant-of-everything-the-bytes-of-almost-nothing|json=0
13
+ QUANTLAW_DRAFT|head=O(size)-paid-once|tail=O(1)-per-consumer|rule=quant-converts-size-tail-cost-to-constant-tuple-cost|status=DRAFT_UNTIL_LIRIS_RERUN_AND_FIDELITY_SWEEP|json=0
14
+ QUANTGUARD|not_proven=semantic_fidelity+real_fabric_engine_binding+gate_safe_similarity|next=rerunnable-tool-COMMITTED(tools/behcs/quant-huge-message-benchmark.mjs)+liris-rerun+JL-distortion-sweep+explicit-binding-to-real-quant-engine-path|json=0
15
+ QUANTBENCHSAFETY|repo_side_only=1|no_live_model_run=1|no_mint=1|temp_files_deleted=1|mutates=receipt+tool+test-files-only|json=0
16
+ QUANTBENCHFTR|state=QUANT_BENCH_SEALED_AS_RECEIPT_NOT_CANON_READY_FOR_LIRIS_RERUN|json=0
docs/ACER-QUANT-HUGE-MESSAGE-BENCH-2026-06-11.hbp.sha256 ADDED
@@ -0,0 +1 @@
 
 
1
+ B00ECAA34B0B30678A41A17331310DEC6AB68C437F9551974BFACAAF4CC9FFA8 ACER-QUANT-HUGE-MESSAGE-BENCH-2026-06-11.hbp
docs/FROZEN-SLICE-REBIND-PREIMAGE-2026-06-11.hbp ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ FROZPREIMAGEHDR|host=acer|date=2026-06-11|pulled_commit=61efe66|topic=exact-aggregate-digest-preimage-for-frozen-slice-rebind|patches=liris-reproducibility-catch-in-LIRIS-FROZEN-SLICE-REBIND-READBACK|json=0
2
+ FROZPREIMAGECONCEDE|liris_catch=CONFIRMED_REAL_AND_KEPT|problem=FROZREBINDDIGEST-row-carried-schema-plus-ELLIPSIZED-components-so-liris-could-not-recompute-77d4e16a-from-committed-bytes|rule-accepted=no-ellipsis-in-digest-inputs|discipline=APPEND-not-REWRITE-this-receipt-supplies-the-preimage-the-rebind-receipt-stays-as-history|json=0
3
+ FROZPREIMAGEFORM|encoding=hex-of-utf8-canonical-string(liris-acceptable-form)|why_hex=canonical-string-contains-pipe-characters-which-collide-with-HBP-field-separators|json=0
4
+ FROZPREIMAGEHEX|chars=596|preimage_hex=6875623d393637373433646439636430336332386564376565316661313261303136366164316238626664396663353861613133353733383637636465333564383933317c6d6f64656c3d643236346662353431653166643463623637666637313036363463656636306135306161613861623666376163646632626635633736393131646264356237367c6d6d70726f6a3d363834383664363831373662393234633566313236623064323561623933653262333834353862363037663436363731643431633136366638633737633230307c6d6f64656c5f62797465733d353333353238353238307c6d6d70726f6a5f62797465733d3939313535313834307c6d6f64656c5f69643d676f6f676c652f67656d6d612d342d6534627c7175616e743d51345f4b5f4d|json=0
5
+ FROZPREIMAGEVERIFY|how=sha256(hex-decoded-bytes)|expected_aggregate_sha256=77d4e16a03b245bb60bcb7339a35cec39c9309d5cf0ff61b452d53c4857c34c7|expected_digest_sha16=77d4e16a03b245bb|acer_roundtrip=VERIFIED-MATCH|one_liner=node-e-console.log(require(crypto).createHash(sha256).update(Buffer.from(HEX,hex)).digest(hex))|json=0
6
+ FROZPREIMAGESAFETY|repo_side_only=1|mutates=receipt-file-only|no-secret-material=preimage-is-public-hashes-sizes-model-id-only|json=0
7
+ FROZPREIMAGEFTR|state=REBIND_DIGEST_NOW_BILATERALLY_REPRODUCIBLE_READY_FOR_LIRIS_RECOMPUTE|json=0
docs/FROZEN-SLICE-REBIND-PREIMAGE-2026-06-11.hbp.sha256 ADDED
@@ -0,0 +1 @@
 
 
1
+ 0B4AA51B5B23F717FE32D989AF37F0C36F09FE55E6D5D502A11CD72E90973E5B FROZEN-SLICE-REBIND-PREIMAGE-2026-06-11.hbp
tests/quant-huge-message-benchmark.unit.test.mjs ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import assert from 'node:assert/strict';
2
+ import test from 'node:test';
3
+
4
+ import {
5
+ CALIBRATION_ROWS,
6
+ D,
7
+ quant8,
8
+ runLiveBenchmark,
9
+ tupleBuffer,
10
+ } from '../tools/behcs/quant-huge-message-benchmark.mjs';
11
+
12
+ test('quant bench definition rows are HBP-only and honestly tagged', () => {
13
+ assert.ok(CALIBRATION_ROWS.length >= 10);
14
+ assert.ok(CALIBRATION_ROWS.every((row) => row.endsWith('json=0')));
15
+ assert.ok(CALIBRATION_ROWS.every((row) => !row.includes('{"')));
16
+ assert.ok(CALIBRATION_ROWS.some((row) => row.includes('FAITHFUL_TO_DOCTRINE_NOT_FABRIC_ENGINE_BINDING')));
17
+ assert.ok(CALIBRATION_ROWS.some((row) => row.includes('fidelity=UNSWEPT')));
18
+ assert.ok(CALIBRATION_ROWS.some((row) => row.includes('DRAFT_UNTIL_LIRIS_RERUN_AND_FIDELITY_SWEEP')));
19
+ });
20
+
21
+ test('quant8 is deterministic and the tuple is constant-size regardless of message size', () => {
22
+ const small = new Float64Array(1024); for (let i = 0; i < small.length; i += 1) small[i] = Math.sin(i);
23
+ const large = new Float64Array(65536); for (let i = 0; i < large.length; i += 1) large[i] = Math.cos(i);
24
+ const q1 = quant8(small);
25
+ const q2 = quant8(small);
26
+ assert.deepEqual(Array.from(q1.turbo), Array.from(q2.turbo));
27
+ assert.equal(q1.scale, q2.scale);
28
+ assert.equal(tupleBuffer(quant8(small)).length, tupleBuffer(quant8(large)).length);
29
+ assert.equal(q1.turbo.length, D);
30
+ });
31
+
32
+ test('live smoke runs disk-free and emits HBP rows', () => {
33
+ const rows = runLiveBenchmark({ sizesMB: [1], disk: false });
34
+ assert.equal(rows[0], 'QUANTBENCHLIVEHDR|sizes_mb=1|disk=0|D=1024|json=0');
35
+ assert.ok(rows.every((row) => row.endsWith('json=0')));
36
+ assert.ok(rows.some((row) => row.includes('message_mb=1') && row.includes('payload_kb=')));
37
+ });
tests/quant-huge-message-benchmark.unit.test.mjs.sha256 ADDED
@@ -0,0 +1 @@
 
 
1
+ 3084ACBBB3B69AA83BFB1C492DD1B4256C03DA2D694F2366587C8CB577907CC2 quant-huge-message-benchmark.unit.test.mjs
tests/supervisor-collision-router.system.test.mjs CHANGED
@@ -52,6 +52,8 @@ const sealedFiles = [
52
  'docs/LIRIS-GEMMA-SUBSTRATE-READBACK-2026-06-11.hbp',
53
  'docs/ACER-GEMMA-INVENTORY-CONFIRM-2026-06-11.hbp',
54
  'docs/FROZEN-SLICE-MANIFEST-REBIND-2026-06-11.hbp',
 
 
55
  'docs/LIRIS-FROZEN-SLICE-REBIND-READBACK-2026-06-11.hbp',
56
  'docs/LIRIS-ACER-NODE24-READBACK-2026-06-11.hbp',
57
  'docs/LIRIS-WATCHER-SUPERVISOR-READBACK-2026-06-11.hbp',
@@ -81,8 +83,10 @@ const sealedFiles = [
81
  'tools/behcs/nnest-watcher-gate.hbp',
82
  'tools/behcs/nnest-watcher-gate.hbi',
83
  'tools/behcs/agent-spawn-throughput-benchmark.mjs',
 
84
  'tools/omni-processor/omnitranslator-v0.js',
85
  'tests/agent-spawn-throughput-benchmark.unit.test.mjs',
 
86
  'tests/d22-verb-adapter.unit.test.mjs',
87
  'tests/d22-parity-probe.unit.test.mjs',
88
  'tests/dashboard-resolver.unit.test.mjs',
 
52
  'docs/LIRIS-GEMMA-SUBSTRATE-READBACK-2026-06-11.hbp',
53
  'docs/ACER-GEMMA-INVENTORY-CONFIRM-2026-06-11.hbp',
54
  'docs/FROZEN-SLICE-MANIFEST-REBIND-2026-06-11.hbp',
55
+ 'docs/FROZEN-SLICE-REBIND-PREIMAGE-2026-06-11.hbp',
56
+ 'docs/ACER-QUANT-HUGE-MESSAGE-BENCH-2026-06-11.hbp',
57
  'docs/LIRIS-FROZEN-SLICE-REBIND-READBACK-2026-06-11.hbp',
58
  'docs/LIRIS-ACER-NODE24-READBACK-2026-06-11.hbp',
59
  'docs/LIRIS-WATCHER-SUPERVISOR-READBACK-2026-06-11.hbp',
 
83
  'tools/behcs/nnest-watcher-gate.hbp',
84
  'tools/behcs/nnest-watcher-gate.hbi',
85
  'tools/behcs/agent-spawn-throughput-benchmark.mjs',
86
+ 'tools/behcs/quant-huge-message-benchmark.mjs',
87
  'tools/omni-processor/omnitranslator-v0.js',
88
  'tests/agent-spawn-throughput-benchmark.unit.test.mjs',
89
+ 'tests/quant-huge-message-benchmark.unit.test.mjs',
90
  'tests/d22-verb-adapter.unit.test.mjs',
91
  'tests/d22-parity-probe.unit.test.mjs',
92
  'tests/dashboard-resolver.unit.test.mjs',
tests/supervisor-collision-router.system.test.mjs.sha256 CHANGED
@@ -1 +1 @@
1
- 4FCB7C614D4DBE38A602FD3688C5941725A0381BAFF116C3F31E20DED38D2E35 supervisor-collision-router.system.test.mjs
 
1
+ 849D0ADEDF959E62F35D6D2F01C2A73027216FEAFF690B681EFE53B4F83F0AD1 supervisor-collision-router.system.test.mjs
tools/behcs/quant-huge-message-benchmark.mjs ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+ import { createHash } from 'node:crypto';
3
+ import { mkdtempSync, writeFileSync, rmSync, openSync, writeSync, closeSync } from 'node:fs';
4
+ import { tmpdir } from 'node:os';
5
+ import { join, resolve } from 'node:path';
6
+ import { fileURLToPath } from 'node:url';
7
+ import { performance } from 'node:perf_hooks';
8
+
9
+ // 8-quant huge-message benchmark: measures the HEAD tax (encode) against the
10
+ // TAIL gains (hash / store / compare on the constant-size tuple). The stages
11
+ // are FAITHFUL-TO-DOCTRINE implementations of the 8 quant engines (Polar,
12
+ // Turbo, JL, Zeta, Triple, Quadruple, JS-histogram, von-Mangoldt), NOT the
13
+ // fabric's shipped engine bindings -- the live fabric derives scalar quants
14
+ // per PID from hashes, a different and cheaper path. Fidelity is UNSWEPT:
15
+ // JL theory bounds compare distortion, but no distortion sweep has been
16
+ // sealed, so no gate may trust quant-space similarity yet.
17
+
18
+ export const D = 1024; // JL output dimensionality -- fixes tuple size ~3.1KB
19
+
20
+ export const CALIBRATION_ROWS = Object.freeze([
21
+ 'QUANTBENCHHDR|tool=quant-huge-message-benchmark.mjs|purpose=measure-head-tax-vs-tail-gains-of-8-stage-quant-on-large-messages|default=definition-rows-only-no-allocation-no-disk|json=0',
22
+ 'QUANTBENCHSCOPE|stages=JL+Turbo+Polar+Zeta+Triple+Quadruple+JS-histogram+von-Mangoldt|status=FAITHFUL_TO_DOCTRINE_NOT_FABRIC_ENGINE_BINDING|fidelity=UNSWEPT|json=0',
23
+ 'QUANTBENCHRESULT|message=1MB|head_ms=1.3|sha_gain=62x|write_gain=2x|compare_gain=8x|payload=3.1KB|host=acer|node=v24.13.1|json=0',
24
+ 'QUANTBENCHRESULT|message=64MB|head_ms=25.2|sha_gain=4774x|write_gain=158x|compare_gain=166x|payload=3.1KB|host=acer|node=v24.13.1|json=0',
25
+ 'QUANTBENCHRESULT|message=256MB|head_ms=123|sha_gain=10239x|write_gain=637x|compare_gain=210x|e2e_gain=8.1x|host=acer|node=v24.13.1|json=0',
26
+ 'QUANTBENCHRESULT|message=1024MB|head_ms=574|sha_gain=66158x|write_gain=2881x|compare_gain=1781x|e2e_gain=6.8x|host=acer|node=v24.13.1|json=0',
27
+ 'QUANTBENCHRESULT|message=2048MB|head_ms=1062|sha_gain=79303x|write_gain=4662x|compare_gain=1698x|e2e_gain=7.2x|ingest=1928MBps|host=acer|node=v24.13.1|json=0',
28
+ 'QUANTBENCHHEADRATE|encode_flat=1.8-to-2.1GBps-from-256MB-to-2GB|meaning=head-tax-is-exactly-linear-never-degrades|json=0',
29
+ 'QUANTBENCHAPILIMIT|finding=raw-2GB-message-breaks-node-single-shot-sha256(ERR_OUT_OF_RANGE-2^31-limit)|quant-tuple=never-hits-API-limits|json=0',
30
+ 'QUANTBENCHRETENTION|raw=7-messages-of-2GB-fit-16GB-RAM|quant=~5M-tuples-of-3.1KB-fit-16GB-RAM|meaning=GC-envelope-economics-at-message-layer|json=0',
31
+ 'QUANTLAW_DRAFT|head=O(size)-paid-once|tail=O(1)-per-consumer|rule=quant-converts-size-tail-cost-to-constant-tuple-cost|status=DRAFT_UNTIL_LIRIS_RERUN_AND_FIDELITY_SWEEP|json=0',
32
+ 'QUANTBENCHFTR|rule=probe-overrules-frame|live_run=pass---run-to-measure-current-machine|json=0',
33
+ ]);
34
+
35
+ // precomputed von-Mangoldt class table for bucket indices
36
+ const PPOW = (() => {
37
+ const t = new Uint8Array(D);
38
+ const isP = (n) => { if (n < 2) return false; for (let i = 2; i * i <= n; i += 1) if (n % i === 0) return false; return true; };
39
+ for (let n = 2; n < D; n += 1) {
40
+ if (isP(n)) { t[n] = 1; continue; }
41
+ for (let p = 2; p * p <= n; p += 1) {
42
+ if (!isP(p)) continue;
43
+ let m = n; let k = 0;
44
+ while (m % p === 0) { m /= p; k += 1; }
45
+ if (m === 1) { t[n] = k > 3 ? 5 : k + 1; break; }
46
+ }
47
+ }
48
+ return t;
49
+ })();
50
+
51
+ export function quant8(msg) {
52
+ const proj = new Float64Array(D);
53
+ for (let i = 0; i < msg.length; i += 1) { // JL count-sketch O(N)
54
+ const h = (i * 2654435761) >>> 0;
55
+ proj[h & (D - 1)] += (h & 0x80000000) ? -msg[i] : msg[i];
56
+ }
57
+ let max = 1e-12;
58
+ for (let j = 0; j < D; j += 1) { const a = Math.abs(proj[j]); if (a > max) max = a; }
59
+ const turbo = new Int8Array(D);
60
+ const signs = new Uint8Array(D >> 3);
61
+ const zeta = new Uint8Array(D);
62
+ const triple = new Int8Array(D);
63
+ const quad = new Uint8Array(D);
64
+ const hist = new Uint32Array(256);
65
+ let vmAcc = 0;
66
+ for (let j = 0; j < D; j += 1) {
67
+ const v = proj[j] / max;
68
+ const q = Math.round(v * 127);
69
+ turbo[j] = q; // Turbo int8
70
+ if (v < 0) signs[j >> 3] |= (1 << (j & 7)); // Polar sign
71
+ const a = Math.abs(v);
72
+ zeta[j] = a < 1e-9 ? 15 : Math.min(15, -Math.log2(a) | 0); // Zeta log bucket
73
+ triple[j] = v > 0.33 ? 1 : (v < -0.33 ? -1 : 0); // Triple
74
+ quad[j] = v > 0.5 ? 3 : v > 0 ? 2 : v > -0.5 ? 1 : 0; // Quadruple
75
+ hist[(q + 128) & 255] += 1; // JS histogram
76
+ if (q !== 0) vmAcc += PPOW[j]; // von-Mangoldt
77
+ }
78
+ return { turbo, signs, zeta, triple, quad, hist, vmAcc, scale: max };
79
+ }
80
+
81
+ export function tupleBuffer(q) {
82
+ return Buffer.concat([
83
+ Buffer.from(q.turbo.buffer), Buffer.from(q.signs.buffer),
84
+ Buffer.from(q.zeta.buffer), Buffer.from(q.hist.buffer),
85
+ ]);
86
+ }
87
+
88
+ function dotRaw(a, b) { let s = 0; for (let i = 0; i < a.length; i += 1) s += a[i] * b[i]; return s; }
89
+ function dotQ(qa, qb) { let s = 0; for (let j = 0; j < D; j += 1) s += qa.turbo[j] * qb.turbo[j]; return s * qa.scale * qb.scale / 16129; }
90
+ function ms(f) { const t = performance.now(); f(); return performance.now() - t; }
91
+ function fill(arr, seed) { let s = seed >>> 0; for (let i = 0; i < arr.length; i += 1) { s = (s * 1664525 + 1013904223) >>> 0; arr[i] = (s / 2147483648) - 1; } }
92
+
93
+ const CHUNK = 1 << 28; // raw paths above 2GB are FORCED into chunking by Node API limits
94
+ function shaChunked(buf) { const h = createHash('sha256'); for (let o = 0; o < buf.length; o += CHUNK) h.update(buf.subarray(o, Math.min(o + CHUNK, buf.length))); return h.digest(); }
95
+ function writeChunked(file, buf) { const fd = openSync(file, 'w'); for (let o = 0; o < buf.length; o += CHUNK) writeSync(fd, buf.subarray(o, Math.min(o + CHUNK, buf.length))); closeSync(fd); }
96
+
97
+ export function runLiveBenchmark(options = {}) {
98
+ const sizesMB = options.sizesMB ?? [64];
99
+ const disk = options.disk ?? false;
100
+ const rows = [`QUANTBENCHLIVEHDR|sizes_mb=${sizesMB.join('+')}|disk=${disk ? 1 : 0}|D=${D}|json=0`];
101
+ const tmp = disk ? mkdtempSync(join(tmpdir(), 'quant-bench-')) : null;
102
+ for (const mb of sizesMB) {
103
+ const dims = Math.floor(mb * 1048576 / 8);
104
+ const msg = new Float64Array(dims); fill(msg, 12345);
105
+ const ref = new Float64Array(dims); fill(ref, 99999);
106
+ let q; let qr;
107
+ const head = ms(() => { q = quant8(msg); qr = quant8(ref); }) / 2;
108
+ const rawBuf = Buffer.from(msg.buffer);
109
+ const qBuf = tupleBuffer(q);
110
+ const hashRaw = ms(() => shaChunked(rawBuf));
111
+ const hashQ = ms(() => createHash('sha256').update(qBuf).digest());
112
+ let wRaw = 0; let wQ = 0;
113
+ if (disk) {
114
+ const f1 = join(tmp, 'raw.bin'); const f2 = join(tmp, 'q.bin');
115
+ wRaw = ms(() => writeChunked(f1, rawBuf));
116
+ wQ = ms(() => writeFileSync(f2, qBuf));
117
+ rmSync(f1, { force: true }); rmSync(f2, { force: true });
118
+ }
119
+ const cmpRaw = ms(() => dotRaw(msg, ref));
120
+ const cmpQ = ms(() => dotQ(q, qr));
121
+ rows.push(`QUANTBENCHLIVE|message_mb=${mb}|head_ms=${head.toFixed(1)}|sha_raw_ms=${hashRaw.toFixed(1)}|sha_q_ms=${hashQ.toFixed(3)}|write_raw_ms=${wRaw.toFixed(1)}|write_q_ms=${wQ.toFixed(3)}|cmp_raw_ms=${cmpRaw.toFixed(1)}|cmp_q_ms=${cmpQ.toFixed(3)}|payload_kb=${(qBuf.length / 1024).toFixed(1)}|json=0`);
122
+ }
123
+ if (tmp) rmSync(tmp, { recursive: true, force: true });
124
+ rows.push('QUANTBENCHLIVEFTR|note=live-rates-are-machine-and-load-dependent-seal-output-in-a-receipt-before-claim-upgrade|json=0');
125
+ return rows;
126
+ }
127
+
128
+ const isMain = process.argv[1] && fileURLToPath(import.meta.url) === resolve(process.argv[1]);
129
+
130
+ if (isMain) {
131
+ const args = process.argv.slice(2);
132
+ if (args.includes('--run')) {
133
+ const sizeArg = args.find((a) => a.startsWith('--sizes='));
134
+ const sizesMB = sizeArg ? sizeArg.slice(8).split(',').map(Number).filter((n) => n > 0) : [64];
135
+ process.stdout.write(`${runLiveBenchmark({ sizesMB, disk: args.includes('--disk') }).join('\n')}\n`);
136
+ } else {
137
+ process.stdout.write(`${CALIBRATION_ROWS.join('\n')}\n`);
138
+ }
139
+ }
tools/behcs/quant-huge-message-benchmark.mjs.sha256 ADDED
@@ -0,0 +1 @@
 
 
1
+ F425D3D9E9E0706B5A3DFB30F12923FEA94B0867456D40D2B2AA8C0A45AB1E91 quant-huge-message-benchmark.mjs