A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
bench(net): four-arm dirty-oracle probe — a verdict on N1, shipping nothing
yhh8ebe1def8f66
diff --git a/bench/replication-dirty/.gitignore b/bench/replication-dirty/.gitignorenew file mode 100644index 000000000..b88c225df--- /dev/null+++ b/bench/replication-dirty/.gitignore@@ -0,0 +1 @@+results.quick.jsondiff --git a/bench/replication-dirty/README.md b/bench/replication-dirty/README.mdnew file mode 100644index 000000000..fea654854--- /dev/null+++ b/bench/replication-dirty/README.md@@ -0,0 +1,94 @@+# Four-arm dirty-oracle probe++Does ChangeTracker-backed candidate discovery cost less than the full shadow+scan replication does today — **without losing any real change**?++This directory answers that and ships nothing. It does not touch+`sdk/src/net/replication/`. It reproduces the production sampling loop so the+arms can differ in exactly one mechanism, and a separate check proves the+reproduction agrees with production.++## The arms++| | write path | sampling |+|---|---|---|+| **A** | tracking off | full shadow scan — today's production |+| **B** | tracking on | full shadow scan — isolates the write tax, alone |+| **C** | tracking on | tracker names candidates, shadow still decides |+| **D** | tracking on | candidates trusted outright |++**D is a counterfactual ceiling.** It assumes the observation completeness this+probe exists to investigate, so it bounds what a future could be worth and+justifies nothing.++## Running it++```sh+node bench/replication-dirty/run.mjs # the 36-point matrix + recall+node bench/replication-dirty/run.mjs --quick # 1k only, for wiring changes+node bench/replication-dirty/completeness.mjs # which write paths report+node bench/replication-dirty/churn.mjs # storage over time+```++Every point runs in its **own process**. Change tracking cannot be turned off+once enabled, so arms A and B cannot share a world; and a cold heap, GC history+and JIT profile are not shareable either. Each process therefore pays the same+warmup (300 ticks) before anything is measured (1200 ticks).++## What is measured++The headline is **total replication tax per simulated second** — write tax plus+sample tax. Not sample speedup: the tracker's tax is paid at 60Hz and the scan+saving is collected at 20Hz, and a report that only times the sample can call a+net loss a win.++GC is **not added** to the tax. A collection inside the measurement window is+already inside the wall time being measured; adding it again would double count.+Allocation, heap delta and GC counts are reported beside the tax as explanatory+variables.++Three ratios, three different questions:++- `B/A` — what does turning tracking on cost the write path, alone?+- `C/B` — having paid that, how much scan does candidate pruning save?+- `C/A` — is the whole architecture worth switching production to?++## What makes the numbers comparable++The mutation schedule is a pure function of `(tick, entityCount, dirtyRate)`.+The same entities take the same values on the same ticks in every arm — no RNG+state, so two processes cannot drift. Selection strides by a prime rather than+taking a contiguous run, so a scan cannot be flattered by locality the real+thing would not have.++Output identity is an order-sensitive digest of everything a sample emitted.+A, B and C claim to produce the same replication output and the digests must be+equal; the digest crosses process boundaries, which in-process comparison+cannot.++## Two verdicts, and one of them can veto++**Correctness** asks a narrow question: of everything a complete scan finds+changed this sample, did the tracker NAME it? Not "did the candidate pass emit+it" — a candidate whose shadow happens to agree emits nothing and was still+correctly named. One miss disqualifies the mechanism whatever the timings say,+and the report prints it that way.++`completeness.mjs` asks the same question of the write paths rather than the+workload: a shadow reads the final value and does not care how it got there; a+tracker is an observation and is only usable as an authoritative source if every+legal write path reports.++## Fidelity notes, and what this does not cover++- The shadow is **seeded at registration**, as `registerEntity_` does: an+ entity's first state goes out in its spawn payload, so its first sample owes+ nothing. An empty shadow instead makes the first sample emit the whole world+ and reads as a catastrophic tracker miss that is really just the baseline.+- `isChangedSince` is a strict `>`, so a window must open one tick before its+ first write. Both off-by-ones here were found by the correctness oracle, not+ by reading the code.+- Components are **script components**. Builtin components write through the+ C++ mirror, and their tracking behaviour is not measured here.+- Physics, UI layout and AOT writeback have their own write paths and are not+ covered. None of them is assumed.diff --git a/bench/replication-dirty/arm.mjs b/bench/replication-dirty/arm.mjsnew file mode 100644index 000000000..6f20fb976--- /dev/null+++ b/bench/replication-dirty/arm.mjs@@ -0,0 +1,188 @@+// SPDX-License-Identifier: Apache-2.0+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team+/**+ * @file One arm at one workload point, in its own process, printing one JSON+ * object. Its own process because change tracking cannot be turned OFF+ * once enabled, and because a cold heap, GC history and JIT profile are+ * not shareable between arms — which is also why every arm pays the same+ * warmup before anything is measured.+ *+ * node bench/replication-dirty/arm.mjs --arm C --entities 10000 --dirty 0.01+ */+import path from 'node:path';+import { fileURLToPath } from 'node:url';+import { PerformanceObserver } from 'node:perf_hooks';+import {+ loadSdk, defineWorkloadComponents, buildWorld, applyTick,+ newShadow, sampleFullShadow, sampleTrackedCandidates, sampleTrackerOnly, Digest,+} from './workload.mjs';++const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', '..');+const argv = process.argv.slice(2);+const flag = (name, fallback) => {+ const i = argv.indexOf(`--${name}`);+ return i >= 0 && argv[i + 1] !== undefined ? argv[i + 1] : fallback;+};++const ARM = flag('arm', 'A');+const ENTITIES = Number(flag('entities', '10000'));+const DIRTY = Number(flag('dirty', '0.01'));+const SIM_HZ = Number(flag('simHz', '60'));+const REPL_HZ = Number(flag('replHz', '20'));+const WARMUP = Number(flag('warmup', '300'));+const MEASURE = Number(flag('measure', '1200'));+/** Arm C only: also compute the full-shadow oracle each sample and compare+ * candidate sets. Timings from a verify run are NOT comparable and say so. */+const VERIFY = argv.includes('--verify');++const REPL_EVERY = Math.round(SIM_HZ / REPL_HZ);+const DIRTY_COUNT = Math.round(ENTITIES * DIRTY);+const TRACKING = ARM !== 'A';++// GC is reported beside the tax, never added to it: a collection inside the+// measurement window is already inside the wall time being measured.+let gcCount = 0;+let gcMs = 0;+try {+ const obs = new PerformanceObserver((list) => {+ for (const e of list.getEntries()) { gcCount++; gcMs += e.duration; }+ });+ obs.observe({ entryTypes: ['gc'] });+} catch { /* not every build exposes gc entries */ }++const sdk = await loadSdk(ROOT);+const app = sdk.App.new();+const world = app.world;+const table = defineWorkloadComponents(sdk);++if (TRACKING) {+ // What a tracker-backed replication layer would have to do: every+ // replicated component, or a change to one is invisible.+ for (const entry of table) world.enableChangeTracking(entry.def);+}++const entities = buildWorld(world, table, ENTITIES);+const shadow = newShadow(world, entities, table);+// The oracle keeps its OWN shadow so what it reports is what a complete scan+// would have found, not what the candidate pass left behind.+const oracleShadow = VERIFY ? newShadow(world, entities, table) : null;++const digest = new Digest();+const recall = { skippedComponents: 0, oracleEntries: 0, missed: 0 };++let writeNs = 0n;+let sampleNs = 0n;+let visited = 0;+let compares = 0;+let candidates = 0;+let samples = 0;+// -1, not 0: the tracker's `since` is a strict `>`, and the very first window+// has to include writes recorded on world tick 0.+let since = -1;++/** One arm's sample. `out` collects (entity, componentIndex, mask) triples. */+function sample(out) {+ switch (ARM) {+ case 'A':+ case 'B': return sampleFullShadow(world, table, entities, shadow, out);+ case 'C': return sampleTrackedCandidates(world, table, entities, shadow, since, out, recall);+ case 'D': return sampleTrackerOnly(world, table, entities, shadow, since, out);+ default: throw new Error(`unknown arm "${ARM}"`);+ }+}++const heapBefore = () => process.memoryUsage().heapUsed;++function runTicks(count, measuring) {+ for (let t = 0; t < count; t++) {+ const tick = measuring ? WARMUP + t : t;+ const w0 = process.hrtime.bigint();+ applyTick(world, table, entities, tick, DIRTY_COUNT);+ world.advanceTick();+ const w1 = process.hrtime.bigint();+ if (measuring) writeNs += w1 - w0;++ if ((tick + 1) % REPL_EVERY !== 0) continue;++ const out = measuring ? digest : new Digest();+ const s0 = process.hrtime.bigint();+ const stats = sample(out);+ const s1 = process.hrtime.bigint();+ if (measuring) {+ sampleNs += s1 - s0;+ samples++;+ visited += stats.visited;+ compares += stats.compares;+ candidates += stats.candidates ?? 0;+ }++ if (VERIFY) verifyAgainstOracle();+ // `isChangedSince` is a STRICT `>`, and the next window's first writes+ // land on the tick the clock reads right now. Storing that tick would+ // exclude them — the window must open one tick earlier.+ since = world.getWorldTick() - 1;+ }+}++/**+ * The correctness half, and it asks the narrow question: of everything a+ * complete scan finds changed this sample, did the tracker NAME it? Not "did+ * the candidate pass emit it" — a candidate whose shadow happened to agree+ * emits nothing and was still correctly named. One miss is disqualifying.+ */+function verifyAgainstOracle() {+ const named = new Set();+ for (let ci = 0; ci < table.length; ci++) {+ const entry = table[ci];+ if (!world.anyChangedSince(entry.def, since)) continue;+ for (const e of entities) {+ if (world.isChangedSince(e, entry.def, since)) named.add(`${e}:${ci}`);+ }+ }+ sampleFullShadow(world, table, entities, oracleShadow, {+ push: (e, ci) => {+ recall.oracleEntries++;+ if (!named.has(`${e}:${ci}`)) recall.missed++;+ },+ });+}++const heap0 = heapBefore();+runTicks(WARMUP, false);+// Measure from a settled heap, and report growth over the window only.+const heap1 = heapBefore();+gcCount = 0; gcMs = 0;+runTicks(MEASURE, true);+const heap2 = heapBefore();++const simSeconds = MEASURE / SIM_HZ;+const us = (ns) => Number(ns) / 1000;++process.stdout.write(`${JSON.stringify({+ arm: ARM,+ entities: ENTITIES,+ dirty: DIRTY,+ simHz: SIM_HZ,+ replHz: REPL_HZ,+ warmup: WARMUP,+ measure: MEASURE,+ verify: VERIFY,+ timingsComparable: !VERIFY,+ simSeconds,+ writeTaxUsPerSimSecond: us(writeNs) / simSeconds,+ sampleTaxUsPerSimSecond: us(sampleNs) / simSeconds,+ totalTaxUsPerSimSecond: (us(writeNs) + us(sampleNs)) / simSeconds,+ samples,+ entriesEmitted: digest.entries,+ digest: digest.value,+ entitiesVisitedPerSimSecond: visited / simSeconds,+ fieldComparesPerSimSecond: compares / simSeconds,+ candidatesPerSimSecond: candidates / simSeconds,+ componentScansSkipped: recall.skippedComponents,+ recall: VERIFY ? { oracleEntries: recall.oracleEntries, missed: recall.missed } : null,+ heapAfterWarmupBytes: heap1,+ heapDeltaBytes: heap2 - heap1,+ heapSetupBytes: heap1 - heap0,+ gcCount,+ gcMs,+}, null, 2)}\n`);diff --git a/bench/replication-dirty/churn.mjs b/bench/replication-dirty/churn.mjsnew file mode 100644index 000000000..7eeb9f6bd--- /dev/null+++ b/bench/replication-dirty/churn.mjs@@ -0,0 +1,115 @@+// SPDX-License-Identifier: Apache-2.0+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team+/**+ * @file Does a tracker-backed consumer have a resource debt in TIME?+ *+ * The timing matrix runs a fixed population and would never see this. A world+ * that spawns, mutates and despawns forever is the ordinary case, and the+ * tracker keeps per-entity rows plus a removed-entity buffer that only shrinks+ * when a consumer calls `cleanRemovedBuffer`. If storage tracks total churn+ * since process start rather than the recent window, no speedup makes the+ * mechanism shippable.+ *+ * Two consumers, same workload:+ * naive — reads the tracker, never cleans (what forgetting looks like)+ * diligent — cleans behind its own sample tick (what a consumer must do)+ *+ * node bench/replication-dirty/churn.mjs+ */+import path from 'node:path';+import { fileURLToPath } from 'node:url';+import { loadSdk, defineWorkloadComponents } from './workload.mjs';++const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', '..');+const argv = process.argv.slice(2);+const flag = (n, d) => { const i = argv.indexOf(`--${n}`); return i >= 0 && argv[i + 1] !== undefined ? argv[i + 1] : d; };++const LIVE = Number(flag('live', '2000')); // steady-state population+const CHURN = Number(flag('churn', '50')); // entities replaced per sim tick+const TICKS = Number(flag('ticks', '3000'));+const REPL_EVERY = 3;++const sdk = await loadSdk(ROOT);++async function run(label, clean) {+ const app = sdk.App.new();+ const world = app.world;+ const table = defineWorkloadComponents(sdk);+ for (const entry of table) world.enableChangeTracking(entry.def);++ const live = [];+ const spawnOne = (i) => {+ const e = world.spawn();+ world.insert(e, table[0].def, { x: i, y: 0, z: 0 });+ world.insert(e, table[1].def, { hp: 100, mp: 50 });+ return e;+ };+ for (let i = 0; i < LIVE; i++) live.push(spawnOne(i));++ const samples = [];+ let since = -1;+ let cursor = 0;++ for (let t = 0; t < TICKS; t++) {+ // Retire and replace a slice: population is constant, churn is not.+ for (let k = 0; k < CHURN; k++) {+ const slot = cursor % live.length;+ const old = live[slot];+ // A replicated component leaving, then the whole entity leaving —+ // both feed the removed buffer.+ if (world.has(old, table[1].def)) world.remove(old, table[1].def);+ world.despawn(old);+ live[slot] = spawnOne(t * CHURN + k);+ cursor++;+ }+ // And ordinary mutation on the survivors.+ for (let k = 0; k < CHURN; k++) {+ const e = live[(cursor + k * 7) % live.length];+ if (world.valid(e)) world.set(e, table[0].def, { x: t, y: k, z: 0 });+ }+ world.advanceTick();++ if ((t + 1) % REPL_EVERY !== 0) continue;+ // A consumer reads what changed…+ for (const entry of table) {+ if (world.anyChangedSince(entry.def, since)) world.getRemovedEntitiesSince(entry.def, since);+ }+ // …and, if it is diligent, tells the tracker it is done with them.+ if (clean) world.cleanRemovedBuffer(world.getWorldTick());+ since = world.getWorldTick() - 1;++ if ((t + 1) % 300 === 0) {+ samples.push({ tick: t + 1, ...world.debugInfo?.().changes ?? sizesOf(world) });+ }+ }+ return { label, samples };+}++/** `world.debugInfo()` may not exist on every build; read the tracker directly. */+function sizesOf(world) {+ const changes = world.changes_ ?? null;+ return changes && typeof changes.sizes === 'function' ? changes.sizes() : {};+}++const runs = [await run('naive (never cleans)', false), await run('diligent (cleans each sample)', true)];++console.log('=== tracker storage under churn ===');+console.log(` ${LIVE} live entities · ${CHURN} replaced per tick · ${TICKS} ticks`);+console.log(' A bounded consumer keeps storage proportional to the RECENT window.');+console.log(' Growth proportional to churn since start is a resource debt, and');+console.log(' disqualifies the mechanism however fast it samples.');+console.log('');+for (const r of runs) {+ console.log(` ${r.label}`);+ console.log(' tick addedRows changedRows removedRows');+ for (const s of r.samples) {+ console.log(` ${String(s.tick).padStart(6)} ${String(s.addedRows ?? '?').padStart(10)}`+ + ` ${String(s.changedRows ?? '?').padStart(11)} ${String(s.removedRows ?? '?').padStart(12)}`);+ }+ const first = r.samples[0];+ const last = r.samples[r.samples.length - 1];+ const grew = (k) => (first?.[k] ?? 0) > 0 ? ((last?.[k] ?? 0) / first[k]).toFixed(2) : '—';+ console.log(` growth first→last: added ×${grew('addedRows')}`+ + ` changed ×${grew('changedRows')} removed ×${grew('removedRows')}`);+ console.log('');+}diff --git a/bench/replication-dirty/completeness.mjs b/bench/replication-dirty/completeness.mjsnew file mode 100644index 000000000..7fc99cd24--- /dev/null+++ b/bench/replication-dirty/completeness.mjs@@ -0,0 +1,119 @@+// SPDX-License-Identifier: Apache-2.0+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team+/**+ * @file Observation completeness: for every way the engine lets a game change+ * replicated state, does the ChangeTracker see it?+ *+ * This is the question the timing matrix cannot answer. A shadow scan reads the+ * final value and does not care how it got there; a tracker is an OBSERVATION,+ * and is only usable as an authoritative candidate source if every legal write+ * path reports. One silent path is disqualifying — that state would simply stop+ * replicating, with nothing anywhere saying so.+ *+ * node bench/replication-dirty/completeness.mjs+ */+import path from 'node:path';+import { fileURLToPath } from 'node:url';+import { loadSdk } from './workload.mjs';++const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', '..');+const sdk = await loadSdk(ROOT);++const results = [];++/**+ * Run one write path against a fresh world and report whether the tracker saw+ * it. `shadowSees` is what a full scan would conclude — the two disagreeing is+ * the whole finding.+ */+async function probe(name, expectation, body) {+ const app = sdk.App.new();+ const world = app.world;+ const C = sdk.defineComponent(`Probe${results.length}`, { v: 0, w: 0 }, { replicatedFields: ['v', 'w'] });+ world.enableChangeTracking(C);++ const e = world.spawn();+ world.insert(e, C, { v: 1, w: 1 });+ world.advanceTick();+ const before = { v: world.tryGet(e, C)?.v, w: world.tryGet(e, C)?.w, had: world.has(e, C) };+ const since = world.getWorldTick() - 1;++ await body(world, e, C, app);++ const after = { v: world.tryGet(e, C)?.v, w: world.tryGet(e, C)?.w, had: world.has(e, C) };+ const shadowSees = before.had !== after.had || before.v !== after.v || before.w !== after.w;+ const trackerSees = world.anyChangedSince(C, since)+ && (world.isChangedSince(e, C, since) || world.getRemovedEntitiesSince(C, since).includes(e));++ results.push({ name, expectation, shadowSees, trackerSees, agree: shadowSees === trackerSees });+}++// --- the documented ways a game writes replicated state ---------------------++await probe('world.set', 'recorded', (world, e, C) => {+ world.set(e, C, { v: 2, w: 1 });+});++await probe('world.insert (replacing)', 'recorded', (world, e, C) => {+ world.insert(e, C, { v: 3, w: 1 });+});++await probe('world.remove', 'recorded', (world, e, C) => {+ world.remove(e, C);+});++// Mut() is a SYSTEM parameter, so this one has to run a real schedule — which+// is the point: it is the write path a system actually uses.+await probe('Mut() query write-back', 'recorded', async (world, e, C, app) => {+ app.addSystemToSchedule(sdk.Schedule.Update, sdk.defineSystem(+ [sdk.Query(sdk.Mut(C))],+ (query) => { for (const [, data] of query) data.v = 4; }, // rows are [entity, ...components]+ ));+ await app.tick(1 / 60);+});++await probe('world.markChanged (no data write)', 'recorded', (world, e, C) => {+ world.markChanged(e, C);+});++/**+ * The one that matters. `tryGet` hands back the LIVE stored object for a script+ * component, so a game can write a field and never call anything. The value is+ * really changed — a shadow scan finds it on its next pass — and no observation+ * was ever emitted.+ */+await probe('tryGet(...).field = v, no set()', 'SILENT', (world, e, C) => {+ const data = world.tryGet(e, C);+ data.v = 5;+});++// ---------------------------------------------------------------------------++const width = Math.max(...results.map((r) => r.name.length));+console.log('=== write-path observation completeness ===');+console.log(' shadow = a full scan would find it · tracker = the ChangeTracker reported it');+console.log('');+for (const r of results) {+ const verdict = r.shadowSees && !r.trackerSees ? 'SILENT — shadow sees it, tracker does not'+ : r.shadowSees && r.trackerSees ? 'observed'+ : !r.shadowSees && r.trackerSees ? 'over-reported (harmless: a candidate that verifies clean)'+ : 'no change made';+ console.log(` ${r.name.padEnd(width)} shadow ${r.shadowSees ? 'Y' : 'n'} tracker ${r.trackerSees ? 'Y' : 'n'} ${verdict}`);+}++const silent = results.filter((r) => r.shadowSees && !r.trackerSees);+console.log('');+if (silent.length === 0) {+ console.log('COMPLETE: every legal write path this probe knows reports to the tracker.');+} else {+ console.log(`INCOMPLETE: ${silent.length} legal write path(s) change replicated state silently:`);+ for (const r of silent) console.log(` - ${r.name}`);+ console.log('');+ console.log('A candidate source that cannot see these cannot be authoritative. Either the');+ console.log('path stops being legal, or it starts reporting, or the shadow scan stays.');+}++console.log('');+console.log('NOT COVERED HERE: builtin components (their writes cross the C++ mirror and');+console.log('need a wasm engine), AOT writeback, and physics/UI systems that write through');+console.log('their own paths. Each is its own answer and none of them is assumed.');diff --git a/bench/replication-dirty/results.json b/bench/replication-dirty/results.jsonnew file mode 100644index 000000000..073e0b10d--- /dev/null+++ b/bench/replication-dirty/results.json@@ -0,0 +1,1290 @@+{+ "machine": {+ "node": "v24.19.0",+ "platform": "win32 10.0.28000",+ "cpu": "Intel(R) Core(TM) i5-14600K",+ "cores": 20,+ "totalMemGB": 32,+ "ranAt": "2026-09-04T12:54:54.869Z"+ },+ "fixed": {+ "simHz": 60,+ "replHz": 20,+ "warmup": 300,+ "measure": 1200+ },+ "points": [+ {+ "arm": "A",+ "entities": 1000,+ "dirty": 0,+ "simHz": 60,+ "replHz": 20,+ "warmup": 300,+ "measure": 1200,+ "verify": false,+ "timingsComparable": true,+ "simSeconds": 20,+ "writeTaxUsPerSimSecond": 10.965,+ "sampleTaxUsPerSimSecond": 7046.545,+ "totalTaxUsPerSimSecond": 7057.509999999999,+ "samples": 400,+ "entriesEmitted": 0,+ "digest": 2166136261,+ "entitiesVisitedPerSimSecond": 80000,+ "fieldComparesPerSimSecond": 180000,+ "candidatesPerSimSecond": 0,+ "componentScansSkipped": 0,+ "recall": null,+ "heapAfterWarmupBytes": 17455504,+ "heapDeltaBytes": 3178792,+ "heapSetupBytes": -1859328,+ "gcCount": 0,+ "gcMs": 0,+ "wallSeconds": 0.28+ },+ {+ "arm": "B",+ "entities": 1000,+ "dirty": 0,+ "simHz": 60,+ "replHz": 20,+ "warmup": 300,+ "measure": 1200,+ "verify": false,+ "timingsComparable": true,+ "simSeconds": 20,+ "writeTaxUsPerSimSecond": 8.540000000000001,+ "sampleTaxUsPerSimSecond": 6975.795,+ "totalTaxUsPerSimSecond": 6984.334999999999,+ "samples": 400,+ "entriesEmitted": 0,+ "digest": 2166136261,+ "entitiesVisitedPerSimSecond": 80000,+ "fieldComparesPerSimSecond": 180000,+ "candidatesPerSimSecond": 0,+ "componentScansSkipped": 0,+ "recall": null,+ "heapAfterWarmupBytes": 18443320,+ "heapDeltaBytes": 3145112,+ "heapSetupBytes": -1538048,+ "gcCount": 0,+ "gcMs": 0,+ "wallSeconds": 0.276+ },+ {+ "arm": "C",+ "entities": 1000,+ "dirty": 0,+ "simHz": 60,+ "replHz": 20,+ "warmup": 300,+ "measure": 1200,+ "verify": false,+ "timingsComparable": true,+ "simSeconds": 20,+ "writeTaxUsPerSimSecond": 5.9399999999999995,+ "sampleTaxUsPerSimSecond": 8.915000000000001,+ "totalTaxUsPerSimSecond": 14.855,+ "samples": 400,+ "entriesEmitted": 0,+ "digest": 2166136261,+ "entitiesVisitedPerSimSecond": 0,+ "fieldComparesPerSimSecond": 0,+ "candidatesPerSimSecond": 0,+ "componentScansSkipped": 1996,+ "recall": null,+ "heapAfterWarmupBytes": 20153088,+ "heapDeltaBytes": 189656,+ "heapSetupBytes": 219272,+ "gcCount": 0,+ "gcMs": 0,+ "wallSeconds": 0.1+ },+ {+ "arm": "D",+ "entities": 1000,+ "dirty": 0,+ "simHz": 60,+ "replHz": 20,+ "warmup": 300,+ "measure": 1200,+ "verify": false,+ "timingsComparable": true,+ "simSeconds": 20,+ "writeTaxUsPerSimSecond": 5.34,+ "sampleTaxUsPerSimSecond": 87.06,+ "totalTaxUsPerSimSecond": 92.4,+ "samples": 400,+ "entriesEmitted": 0,+ "digest": 2166136261,+ "entitiesVisitedPerSimSecond": 0,+ "fieldComparesPerSimSecond": 0,+ "candidatesPerSimSecond": 0,+ "componentScansSkipped": 0,+ "recall": null,+ "heapAfterWarmupBytes": 20074264,+ "heapDeltaBytes": 223896,+ "heapSetupBytes": 118592,+ "gcCount": 0,+ "gcMs": 0,+ "wallSeconds": 0.102+ },+ {+ "arm": "A",+ "entities": 1000,+ "dirty": 0.01,+ "simHz": 60,+ "replHz": 20,+ "warmup": 300,+ "measure": 1200,+ "verify": false,+ "timingsComparable": true,+ "simSeconds": 20,+ "writeTaxUsPerSimSecond": 244.09499999999997,+ "sampleTaxUsPerSimSecond": 7560.889999999999,+ "totalTaxUsPerSimSecond": 7804.984999999999,+ "samples": 400,+ "entriesEmitted": 11998,+ "digest": 2220373607,+ "entitiesVisitedPerSimSecond": 80000,+ "fieldComparesPerSimSecond": 180000,+ "candidatesPerSimSecond": 0,+ "componentScansSkipped": 0,+ "recall": null,+ "heapAfterWarmupBytes": 21662072,+ "heapDeltaBytes": -2503680,+ "heapSetupBytes": 2338352,+ "gcCount": 0,+ "gcMs": 0,+ "wallSeconds": 0.299+ },+ {+ "arm": "B",+ "entities": 1000,+ "dirty": 0.01,+ "simHz": 60,+ "replHz": 20,+ "warmup": 300,+ "measure": 1200,+ "verify": false,+ "timingsComparable": true,+ "simSeconds": 20,+ "writeTaxUsPerSimSecond": 281.645,+ "sampleTaxUsPerSimSecond": 7024.795,+ "totalTaxUsPerSimSecond": 7306.44,+ "samples": 400,+ "entriesEmitted": 11998,+ "digest": 2220373607,+ "entitiesVisitedPerSimSecond": 80000,+ "fieldComparesPerSimSecond": 180000,+ "candidatesPerSimSecond": 0,+ "componentScansSkipped": 0,+ "recall": null,+ "heapAfterWarmupBytes": 22567088,+ "heapDeltaBytes": -2533496,+ "heapSetupBytes": 2582768,+ "gcCount": 0,+ "gcMs": 0,+ "wallSeconds": 0.286+ },+ {+ "arm": "C",+ "entities": 1000,+ "dirty": 0.01,+ "simHz": 60,+ "replHz": 20,+ "warmup": 300,+ "measure": 1200,+ "verify": false,+ "timingsComparable": true,+ "simSeconds": 20,+ "writeTaxUsPerSimSecond": 234.215,+ "sampleTaxUsPerSimSecond": 1287.565,+ "totalTaxUsPerSimSecond": 1521.78,+ "samples": 400,+ "entriesEmitted": 11998,+ "digest": 2220373607,+ "entitiesVisitedPerSimSecond": 60000,+ "fieldComparesPerSimSecond": 1399.8,+ "candidatesPerSimSecond": 600,+ "componentScansSkipped": 499,+ "recall": null,+ "heapAfterWarmupBytes": 18642752,+ "heapDeltaBytes": 4765272,+ "heapSetupBytes": -1327840,+ "gcCount": 0,+ "gcMs": 0,+ "wallSeconds": 0.14+ },+ {+ "arm": "D",+ "entities": 1000,+ "dirty": 0.01,+ "simHz": 60,+ "replHz": 20,+ "warmup": 300,+ "measure": 1200,+ "verify": false,+ "timingsComparable": true,+ "simSeconds": 20,+ "writeTaxUsPerSimSecond": 255.41,+ "sampleTaxUsPerSimSecond": 1123.325,+ "totalTaxUsPerSimSecond": 1378.7350000000001,+ "samples": 400,+ "entriesEmitted": 12000,+ "digest": 3725193869,+ "entitiesVisitedPerSimSecond": 60000,+ "fieldComparesPerSimSecond": 0,+ "candidatesPerSimSecond": 600,+ "componentScansSkipped": 0,+ "recall": null,+ "heapAfterWarmupBytes": 18599496,+ "heapDeltaBytes": 4436304,+ "heapSetupBytes": -1441256,+ "gcCount": 0,+ "gcMs": 0,+ "wallSeconds": 0.139+ },+ {+ "arm": "A",+ "entities": 1000,+ "dirty": 1,+ "simHz": 60,+ "replHz": 20,+ "warmup": 300,+ "measure": 1200,+ "verify": false,+ "timingsComparable": true,+ "simSeconds": 20,+ "writeTaxUsPerSimSecond": 11438.02,+ "sampleTaxUsPerSimSecond": 7403.635,+ "totalTaxUsPerSimSecond": 18841.655,+ "samples": 400,+ "entriesEmitted": 1200000,+ "digest": 3153663685,+ "entitiesVisitedPerSimSecond": 80000,+ "fieldComparesPerSimSecond": 180000,+ "candidatesPerSimSecond": 0,+ "componentScansSkipped": 0,+ "recall": null,+ "heapAfterWarmupBytes": 17816712,+ "heapDeltaBytes": 5664664,+ "heapSetupBytes": -1517784,+ "gcCount": 0,+ "gcMs": 0,+ "wallSeconds": 0.578+ },+ {+ "arm": "B",+ "entities": 1000,+ "dirty": 1,+ "simHz": 60,+ "replHz": 20,+ "warmup": 300,+ "measure": 1200,+ "verify": false,+ "timingsComparable": true,+ "simSeconds": 20,+ "writeTaxUsPerSimSecond": 12947.25,+ "sampleTaxUsPerSimSecond": 7680.725,+ "totalTaxUsPerSimSecond": 20627.975,+ "samples": 400,+ "entriesEmitted": 1200000,+ "digest": 3153663685,+ "entitiesVisitedPerSimSecond": 80000,+ "fieldComparesPerSimSecond": 180000,+ "candidatesPerSimSecond": 0,+ "componentScansSkipped": 0,+ "recall": null,+ "heapAfterWarmupBytes": 20097232,+ "heapDeltaBytes": -2657720,+ "heapSetupBytes": 81600,+ "gcCount": 0,+ "gcMs": 0,+ "wallSeconds": 0.625+ },+ {+ "arm": "C",+ "entities": 1000,+ "dirty": 1,+ "simHz": 60,+ "replHz": 20,+ "warmup": 300,+ "measure": 1200,+ "verify": false,+ "timingsComparable": true,+ "simSeconds": 20,+ "writeTaxUsPerSimSecond": 12644.210000000001,+ "sampleTaxUsPerSimSecond": 7021.460000000001,+ "totalTaxUsPerSimSecond": 19665.670000000002,+ "samples": 400,+ "entriesEmitted": 1200000,+ "digest": 3153663685,+ "entitiesVisitedPerSimSecond": 60000,+ "fieldComparesPerSimSecond": 140000,+ "candidatesPerSimSecond": 60000,+ "componentScansSkipped": 499,+ "recall": null,+ "heapAfterWarmupBytes": 19243480,+ "heapDeltaBytes": -2813432,+ "heapSetupBytes": -651288,+ "gcCount": 0,+ "gcMs": 0,+ "wallSeconds": 0.598+ },+ {+ "arm": "D",+ "entities": 1000,+ "dirty": 1,+ "simHz": 60,+ "replHz": 20,+ "warmup": 300,+ "measure": 1200,+ "verify": false,+ "timingsComparable": true,+ "simSeconds": 20,+ "writeTaxUsPerSimSecond": 13071.66,+ "sampleTaxUsPerSimSecond": 2088.29,+ "totalTaxUsPerSimSecond": 15159.95,+ "samples": 400,+ "entriesEmitted": 1200000,+ "digest": 243129797,+ "entitiesVisitedPerSimSecond": 60000,+ "fieldComparesPerSimSecond": 0,+ "candidatesPerSimSecond": 60000,+ "componentScansSkipped": 0,+ "recall": null,+ "heapAfterWarmupBytes": 17229688,+ "heapDeltaBytes": 2882576,+ "heapSetupBytes": -2643880,+ "gcCount": 0,+ "gcMs": 0,+ "wallSeconds": 0.489+ },+ {+ "arm": "A",+ "entities": 10000,+ "dirty": 0,+ "simHz": 60,+ "replHz": 20,+ "warmup": 300,+ "measure": 1200,+ "verify": false,+ "timingsComparable": true,+ "simSeconds": 20,+ "writeTaxUsPerSimSecond": 40.345,+ "sampleTaxUsPerSimSecond": 114951.06000000001,+ "totalTaxUsPerSimSecond": 114991.405,+ "samples": 400,+ "entriesEmitted": 0,+ "digest": 2166136261,+ "entitiesVisitedPerSimSecond": 800000,+ "fieldComparesPerSimSecond": 1800000,+ "candidatesPerSimSecond": 0,+ "componentScansSkipped": 0,+ "recall": null,+ "heapAfterWarmupBytes": 102642400,+ "heapDeltaBytes": -21414168,+ "heapSetupBytes": 11244016,+ "gcCount": 0,+ "gcMs": 0,+ "wallSeconds": 3.128+ },+ {+ "arm": "B",+ "entities": 10000,+ "dirty": 0,+ "simHz": 60,+ "replHz": 20,+ "warmup": 300,+ "measure": 1200,+ "verify": false,+ "timingsComparable": true,+ "simSeconds": 20,+ "writeTaxUsPerSimSecond": 42.489999999999995,+ "sampleTaxUsPerSimSecond": 114856.11000000002,+ "totalTaxUsPerSimSecond": 114898.6,+ "samples": 400,+ "entriesEmitted": 0,+ "digest": 2166136261,+ "entitiesVisitedPerSimSecond": 800000,+ "fieldComparesPerSimSecond": 1800000,+ "candidatesPerSimSecond": 0,+ "componentScansSkipped": 0,+ "recall": null,+ "heapAfterWarmupBytes": 108745016,+ "heapDeltaBytes": -21316224,+ "heapSetupBytes": 11083352,+ "gcCount": 0,+ "gcMs": 0,+ "wallSeconds": 3.141+ },+ {+ "arm": "C",+ "entities": 10000,+ "dirty": 0,+ "simHz": 60,+ "replHz": 20,+ "warmup": 300,+ "measure": 1200,+ "verify": false,+ "timingsComparable": true,+ "simSeconds": 20,+ "writeTaxUsPerSimSecond": 6.365,+ "sampleTaxUsPerSimSecond": 7.565,+ "totalTaxUsPerSimSecond": 13.930000000000001,+ "samples": 400,+ "entriesEmitted": 0,+ "digest": 2166136261,+ "entitiesVisitedPerSimSecond": 0,+ "fieldComparesPerSimSecond": 0,+ "candidatesPerSimSecond": 0,+ "componentScansSkipped": 1996,+ "recall": null,+ "heapAfterWarmupBytes": 98498808,+ "heapDeltaBytes": 546472,+ "heapSetupBytes": 1242648,+ "gcCount": 0,+ "gcMs": 0,+ "wallSeconds": 0.244+ },+ {+ "arm": "D",+ "entities": 10000,+ "dirty": 0,+ "simHz": 60,+ "replHz": 20,+ "warmup": 300,+ "measure": 1200,+ "verify": false,+ "timingsComparable": true,+ "simSeconds": 20,+ "writeTaxUsPerSimSecond": 5.66,+ "sampleTaxUsPerSimSecond": 6.545,+ "totalTaxUsPerSimSecond": 12.205000000000002,+ "samples": 400,+ "entriesEmitted": 0,+ "digest": 2166136261,+ "entitiesVisitedPerSimSecond": 0,+ "fieldComparesPerSimSecond": 0,+ "candidatesPerSimSecond": 0,+ "componentScansSkipped": 0,+ "recall": null,+ "heapAfterWarmupBytes": 98554760,+ "heapDeltaBytes": -374152,+ "heapSetupBytes": 726168,+ "gcCount": 0,+ "gcMs": 0,+ "wallSeconds": 0.236+ },+ {+ "arm": "A",+ "entities": 10000,+ "dirty": 0.01,+ "simHz": 60,+ "replHz": 20,+ "warmup": 300,+ "measure": 1200,+ "verify": false,+ "timingsComparable": true,+ "simSeconds": 20,+ "writeTaxUsPerSimSecond": 4500.075,+ "sampleTaxUsPerSimSecond": 138985.375,+ "totalTaxUsPerSimSecond": 143485.45,+ "samples": 400,+ "entriesEmitted": 120000,+ "digest": 3022072142,+ "entitiesVisitedPerSimSecond": 800000,+ "fieldComparesPerSimSecond": 1800000,+ "candidatesPerSimSecond": 0,+ "componentScansSkipped": 0,+ "recall": null,+ "heapAfterWarmupBytes": 130029176,+ "heapDeltaBytes": 10855848,+ "heapSetupBytes": 38692360,+ "gcCount": 0,+ "gcMs": 0,+ "wallSeconds": 3.763+ },+ {+ "arm": "B",+ "entities": 10000,+ "dirty": 0.01,+ "simHz": 60,+ "replHz": 20,+ "warmup": 300,+ "measure": 1200,+ "verify": false,+ "timingsComparable": true,+ "simSeconds": 20,+ "writeTaxUsPerSimSecond": 5748.62,+ "sampleTaxUsPerSimSecond": 141354.605,+ "totalTaxUsPerSimSecond": 147103.225,+ "samples": 400,+ "entriesEmitted": 120000,+ "digest": 3022072142,+ "entitiesVisitedPerSimSecond": 800000,+ "fieldComparesPerSimSecond": 1800000,+ "candidatesPerSimSecond": 0,+ "componentScansSkipped": 0,+ "recall": null,+ "heapAfterWarmupBytes": 136163144,+ "heapDeltaBytes": 10822648,+ "heapSetupBytes": 38385896,+ "gcCount": 0,+ "gcMs": 0,+ "wallSeconds": 3.867+ },+ {+ "arm": "C",+ "entities": 10000,+ "dirty": 0.01,+ "simHz": 60,+ "replHz": 20,+ "warmup": 300,+ "measure": 1200,+ "verify": false,+ "timingsComparable": true,+ "simSeconds": 20,+ "writeTaxUsPerSimSecond": 2516.12,+ "sampleTaxUsPerSimSecond": 13391.429999999998,+ "totalTaxUsPerSimSecond": 15907.55,+ "samples": 400,+ "entriesEmitted": 120000,+ "digest": 3022072142,+ "entitiesVisitedPerSimSecond": 600000,+ "fieldComparesPerSimSecond": 14000,+ "candidatesPerSimSecond": 6000,+ "componentScansSkipped": 499,+ "recall": null,+ "heapAfterWarmupBytes": 84383264,+ "heapDeltaBytes": 45933720,+ "heapSetupBytes": -13321296,+ "gcCount": 0,+ "gcMs": 0,+ "wallSeconds": 0.655+ },+ {+ "arm": "D",+ "entities": 10000,+ "dirty": 0.01,+ "simHz": 60,+ "replHz": 20,+ "warmup": 300,+ "measure": 1200,+ "verify": false,+ "timingsComparable": true,+ "simSeconds": 20,+ "writeTaxUsPerSimSecond": 2558.605,+ "sampleTaxUsPerSimSecond": 11482.39,+ "totalTaxUsPerSimSecond": 14040.994999999999,+ "samples": 400,+ "entriesEmitted": 120000,+ "digest": 1543329389,+ "entitiesVisitedPerSimSecond": 600000,+ "fieldComparesPerSimSecond": 0,+ "candidatesPerSimSecond": 6000,+ "componentScansSkipped": 0,+ "recall": null,+ "heapAfterWarmupBytes": 125708600,+ "heapDeltaBytes": -1060216,+ "heapSetupBytes": 27967888,+ "gcCount": 0,+ "gcMs": 0,+ "wallSeconds": 0.591+ },+ {+ "arm": "A",+ "entities": 10000,+ "dirty": 1,+ "simHz": 60,+ "replHz": 20,+ "warmup": 300,+ "measure": 1200,+ "verify": false,+ "timingsComparable": true,+ "simSeconds": 20,+ "writeTaxUsPerSimSecond": 153508.885,+ "sampleTaxUsPerSimSecond": 94627.75,+ "totalTaxUsPerSimSecond": 248136.635,+ "samples": 400,+ "entriesEmitted": 12000000,+ "digest": 999528389,+ "entitiesVisitedPerSimSecond": 800000,+ "fieldComparesPerSimSecond": 1800000,+ "candidatesPerSimSecond": 0,+ "componentScansSkipped": 0,+ "recall": null,+ "heapAfterWarmupBytes": 105013728,+ "heapDeltaBytes": 36894944,+ "heapSetupBytes": 13737416,+ "gcCount": 0,+ "gcMs": 0,+ "wallSeconds": 6.444+ },+ {+ "arm": "B",+ "entities": 10000,+ "dirty": 1,+ "simHz": 60,+ "replHz": 20,+ "warmup": 300,+ "measure": 1200,+ "verify": false,+ "timingsComparable": true,+ "simSeconds": 20,+ "writeTaxUsPerSimSecond": 186050.66499999998,+ "sampleTaxUsPerSimSecond": 94507.56,+ "totalTaxUsPerSimSecond": 280558.225,+ "samples": 400,+ "entriesEmitted": 12000000,+ "digest": 999528389,+ "entitiesVisitedPerSimSecond": 800000,+ "fieldComparesPerSimSecond": 1800000,+ "candidatesPerSimSecond": 0,+ "componentScansSkipped": 0,+ "recall": null,+ "heapAfterWarmupBytes": 111072536,+ "heapDeltaBytes": 36994264,+ "heapSetupBytes": 13585768,+ "gcCount": 0,+ "gcMs": 0,+ "wallSeconds": 7.301+ },+ {+ "arm": "C",+ "entities": 10000,+ "dirty": 1,+ "simHz": 60,+ "replHz": 20,+ "warmup": 300,+ "measure": 1200,+ "verify": false,+ "timingsComparable": true,+ "simSeconds": 20,+ "writeTaxUsPerSimSecond": 186046.45500000002,+ "sampleTaxUsPerSimSecond": 91805.61,+ "totalTaxUsPerSimSecond": 277852.065,+ "samples": 400,+ "entriesEmitted": 12000000,+ "digest": 999528389,+ "entitiesVisitedPerSimSecond": 600000,+ "fieldComparesPerSimSecond": 1400000,+ "candidatesPerSimSecond": 600000,+ "componentScansSkipped": 499,+ "recall": null,+ "heapAfterWarmupBytes": 110817496,+ "heapDeltaBytes": 36868968,+ "heapSetupBytes": 13009448,+ "gcCount": 0,+ "gcMs": 0,+ "wallSeconds": 7.229+ },+ {+ "arm": "D",+ "entities": 10000,+ "dirty": 1,+ "simHz": 60,+ "replHz": 20,+ "warmup": 300,+ "measure": 1200,+ "verify": false,+ "timingsComparable": true,+ "simSeconds": 20,+ "writeTaxUsPerSimSecond": 164644.63999999998,+ "sampleTaxUsPerSimSecond": 22821.395,+ "totalTaxUsPerSimSecond": 187466.03499999997,+ "samples": 400,+ "entriesEmitted": 12000000,+ "digest": 4142743493,+ "entitiesVisitedPerSimSecond": 600000,+ "fieldComparesPerSimSecond": 0,+ "candidatesPerSimSecond": 600000,+ "componentScansSkipped": 0,+ "recall": null,+ "heapAfterWarmupBytes": 133262312,+ "heapDeltaBytes": -8274224,+ "heapSetupBytes": 35572696,+ "gcCount": 0,+ "gcMs": 0,+ "wallSeconds": 4.939+ },+ {+ "arm": "A",+ "entities": 100000,+ "dirty": 0,+ "simHz": 60,+ "replHz": 20,+ "warmup": 300,+ "measure": 1200,+ "verify": false,+ "timingsComparable": true,+ "simSeconds": 20,+ "writeTaxUsPerSimSecond": 41.795,+ "sampleTaxUsPerSimSecond": 1866847.1600000001,+ "totalTaxUsPerSimSecond": 1866888.955,+ "samples": 400,+ "entriesEmitted": 0,+ "digest": 2166136261,+ "entitiesVisitedPerSimSecond": 8000000,+ "fieldComparesPerSimSecond": 18000000,+ "candidatesPerSimSecond": 0,+ "componentScansSkipped": 0,+ "recall": null,+ "heapAfterWarmupBytes": 594396096,+ "heapDeltaBytes": -15739272,+ "heapSetupBytes": 35665656,+ "gcCount": 0,+ "gcMs": 0,+ "wallSeconds": 47.888+ },+ {+ "arm": "B",+ "entities": 100000,+ "dirty": 0,+ "simHz": 60,+ "replHz": 20,+ "warmup": 300,+ "measure": 1200,+ "verify": false,+ "timingsComparable": true,+ "simSeconds": 20,+ "writeTaxUsPerSimSecond": 45.545,+ "sampleTaxUsPerSimSecond": 2011313.85,+ "totalTaxUsPerSimSecond": 2011359.395,+ "samples": 400,+ "entriesEmitted": 0,+ "digest": 2166136261,+ "entitiesVisitedPerSimSecond": 8000000,+ "fieldComparesPerSimSecond": 18000000,+ "candidatesPerSimSecond": 0,+ "componentScansSkipped": 0,+ "recall": null,+ "heapAfterWarmupBytes": 667216864,+ "heapDeltaBytes": -15643344,+ "heapSetupBytes": 24426760,+ "gcCount": 0,+ "gcMs": 0,+ "wallSeconds": 51.753+ },+ {+ "arm": "C",+ "entities": 100000,+ "dirty": 0,+ "simHz": 60,+ "replHz": 20,+ "warmup": 300,+ "measure": 1200,+ "verify": false,+ "timingsComparable": true,+ "simSeconds": 20,+ "writeTaxUsPerSimSecond": 6.475,+ "sampleTaxUsPerSimSecond": 6.43,+ "totalTaxUsPerSimSecond": 12.905000000000001,+ "samples": 400,+ "entriesEmitted": 0,+ "digest": 2166136261,+ "entitiesVisitedPerSimSecond": 0,+ "fieldComparesPerSimSecond": 0,+ "candidatesPerSimSecond": 0,+ "componentScansSkipped": 1996,+ "recall": null,+ "heapAfterWarmupBytes": 654116960,+ "heapDeltaBytes": 184760,+ "heapSetupBytes": 11353608,+ "gcCount": 0,+ "gcMs": 0,+ "wallSeconds": 1.541+ },+ {+ "arm": "D",+ "entities": 100000,+ "dirty": 0,+ "simHz": 60,+ "replHz": 20,+ "warmup": 300,+ "measure": 1200,+ "verify": false,+ "timingsComparable": true,+ "simSeconds": 20,+ "writeTaxUsPerSimSecond": 7.265000000000001,+ "sampleTaxUsPerSimSecond": 17.384999999999998,+ "totalTaxUsPerSimSecond": 24.65,+ "samples": 400,+ "entriesEmitted": 0,+ "digest": 2166136261,+ "entitiesVisitedPerSimSecond": 0,+ "fieldComparesPerSimSecond": 0,+ "candidatesPerSimSecond": 0,+ "componentScansSkipped": 0,+ "recall": null,+ "heapAfterWarmupBytes": 635815408,+ "heapDeltaBytes": 537264,+ "heapSetupBytes": 137704,+ "gcCount": 0,+ "gcMs": 0,+ "wallSeconds": 1.663+ },+ {+ "arm": "A",+ "entities": 100000,+ "dirty": 0.01,+ "simHz": 60,+ "replHz": 20,+ "warmup": 300,+ "measure": 1200,+ "verify": false,+ "timingsComparable": true,+ "simSeconds": 20,+ "writeTaxUsPerSimSecond": 54919.31999999999,+ "sampleTaxUsPerSimSecond": 1820404.155,+ "totalTaxUsPerSimSecond": 1875323.475,+ "samples": 400,+ "entriesEmitted": 1199996,+ "digest": 658124378,+ "entitiesVisitedPerSimSecond": 8000000,+ "fieldComparesPerSimSecond": 18000000,+ "candidatesPerSimSecond": 0,+ "componentScansSkipped": 0,+ "recall": null,+ "heapAfterWarmupBytes": 582103056,+ "heapDeltaBytes": 37165192,+ "heapSetupBytes": 23643944,+ "gcCount": 0,+ "gcMs": 0,+ "wallSeconds": 49.064+ },+ {+ "arm": "B",+ "entities": 100000,+ "dirty": 0.01,+ "simHz": 60,+ "replHz": 20,+ "warmup": 300,+ "measure": 1200,+ "verify": false,+ "timingsComparable": true,+ "simSeconds": 20,+ "writeTaxUsPerSimSecond": 68314.73000000001,+ "sampleTaxUsPerSimSecond": 1836132.2899999998,+ "totalTaxUsPerSimSecond": 1904447.02,+ "samples": 400,+ "entriesEmitted": 1199996,+ "digest": 658124378,+ "entitiesVisitedPerSimSecond": 8000000,+ "fieldComparesPerSimSecond": 18000000,+ "candidatesPerSimSecond": 0,+ "componentScansSkipped": 0,+ "recall": null,+ "heapAfterWarmupBytes": 646898520,+ "heapDeltaBytes": 37118672,+ "heapSetupBytes": 17196416,+ "gcCount": 0,+ "gcMs": 0,+ "wallSeconds": 48.99+ },+ {+ "arm": "C",+ "entities": 100000,+ "dirty": 0.01,+ "simHz": 60,+ "replHz": 20,+ "warmup": 300,+ "measure": 1200,+ "verify": false,+ "timingsComparable": true,+ "simSeconds": 20,+ "writeTaxUsPerSimSecond": 64972.935,+ "sampleTaxUsPerSimSecond": 297707.65,+ "totalTaxUsPerSimSecond": 362680.585,+ "samples": 400,+ "entriesEmitted": 1199996,+ "digest": 658124378,+ "entitiesVisitedPerSimSecond": 6000000,+ "fieldComparesPerSimSecond": 139999.9,+ "candidatesPerSimSecond": 60000,+ "componentScansSkipped": 499,+ "recall": null,+ "heapAfterWarmupBytes": 693963120,+ "heapDeltaBytes": -36384280,+ "heapSetupBytes": 51227536,+ "gcCount": 0,+ "gcMs": 0,+ "wallSeconds": 10.592+ },+ {+ "arm": "D",+ "entities": 100000,+ "dirty": 0.01,+ "simHz": 60,+ "replHz": 20,+ "warmup": 300,+ "measure": 1200,+ "verify": false,+ "timingsComparable": true,+ "simSeconds": 20,+ "writeTaxUsPerSimSecond": 64492.6,+ "sampleTaxUsPerSimSecond": 218170.45,+ "totalTaxUsPerSimSecond": 282663.05,+ "samples": 400,+ "entriesEmitted": 1200000,+ "digest": 3590271328,+ "entitiesVisitedPerSimSecond": 6000000,+ "fieldComparesPerSimSecond": 0,+ "candidatesPerSimSecond": 60000,+ "componentScansSkipped": 0,+ "recall": null,+ "heapAfterWarmupBytes": 671472048,+ "heapDeltaBytes": -13913480,+ "heapSetupBytes": 28688912,+ "gcCount": 0,+ "gcMs": 0,+ "wallSeconds": 8.621+ },+ {+ "arm": "A",+ "entities": 100000,+ "dirty": 1,+ "simHz": 60,+ "replHz": 20,+ "warmup": 300,+ "measure": 1200,+ "verify": false,+ "timingsComparable": true,+ "simSeconds": 20,+ "writeTaxUsPerSimSecond": 3113595.46,+ "sampleTaxUsPerSimSecond": 1509476.215,+ "totalTaxUsPerSimSecond": 4623071.675,+ "samples": 400,+ "entriesEmitted": 120000000,+ "digest": 647479749,+ "entitiesVisitedPerSimSecond": 8000000,+ "fieldComparesPerSimSecond": 18000000,+ "candidatesPerSimSecond": 0,+ "componentScansSkipped": 0,+ "recall": null,+ "heapAfterWarmupBytes": 579722344,+ "heapDeltaBytes": 31742888,+ "heapSetupBytes": 19945856,+ "gcCount": 0,+ "gcMs": 0,+ "wallSeconds": 117.99+ },+ {+ "arm": "B",+ "entities": 100000,+ "dirty": 1,+ "simHz": 60,+ "replHz": 20,+ "warmup": 300,+ "measure": 1200,+ "verify": false,+ "timingsComparable": true,+ "simSeconds": 20,+ "writeTaxUsPerSimSecond": 4261652.2,+ "sampleTaxUsPerSimSecond": 1538083.27,+ "totalTaxUsPerSimSecond": 5799735.470000001,+ "samples": 400,+ "entriesEmitted": 120000000,+ "digest": 647479749,+ "entitiesVisitedPerSimSecond": 8000000,+ "fieldComparesPerSimSecond": 18000000,+ "candidatesPerSimSecond": 0,+ "componentScansSkipped": 0,+ "recall": null,+ "heapAfterWarmupBytes": 662636040,+ "heapDeltaBytes": 27365408,+ "heapSetupBytes": 19707632,+ "gcCount": 0,+ "gcMs": 0,+ "wallSeconds": 146.266+ },+ {+ "arm": "C",+ "entities": 100000,+ "dirty": 1,+ "simHz": 60,+ "replHz": 20,+ "warmup": 300,+ "measure": 1200,+ "verify": false,+ "timingsComparable": true,+ "simSeconds": 20,+ "writeTaxUsPerSimSecond": 4411569.115,+ "sampleTaxUsPerSimSecond": 1603400.73,+ "totalTaxUsPerSimSecond": 6014969.845000001,+ "samples": 400,+ "entriesEmitted": 120000000,+ "digest": 647479749,+ "entitiesVisitedPerSimSecond": 6000000,+ "fieldComparesPerSimSecond": 14000000,+ "candidatesPerSimSecond": 6000000,+ "componentScansSkipped": 499,+ "recall": null,+ "heapAfterWarmupBytes": 653320704,+ "heapDeltaBytes": 27165400,+ "heapSetupBytes": 21314952,+ "gcCount": 0,+ "gcMs": 0,+ "wallSeconds": 152.772+ },+ {+ "arm": "D",+ "entities": 100000,+ "dirty": 1,+ "simHz": 60,+ "replHz": 20,+ "warmup": 300,+ "measure": 1200,+ "verify": false,+ "timingsComparable": true,+ "simSeconds": 20,+ "writeTaxUsPerSimSecond": 4454144.425,+ "sampleTaxUsPerSimSecond": 390374.02,+ "totalTaxUsPerSimSecond": 4844518.445,+ "samples": 400,+ "entriesEmitted": 120000000,+ "digest": 355343813,+ "entitiesVisitedPerSimSecond": 6000000,+ "fieldComparesPerSimSecond": 0,+ "candidatesPerSimSecond": 6000000,+ "componentScansSkipped": 0,+ "recall": null,+ "heapAfterWarmupBytes": 682793504,+ "heapDeltaBytes": -23699288,+ "heapSetupBytes": 40355056,+ "gcCount": 0,+ "gcMs": 0,+ "wallSeconds": 122.405+ }+ ],+ "verifies": [+ {+ "arm": "C",+ "entities": 1000,+ "dirty": 0,+ "simHz": 60,+ "replHz": 20,+ "warmup": 300,+ "measure": 1200,+ "verify": true,+ "timingsComparable": false,+ "simSeconds": 20,+ "writeTaxUsPerSimSecond": 9.1,+ "sampleTaxUsPerSimSecond": 3.71,+ "totalTaxUsPerSimSecond": 12.809999999999999,+ "samples": 400,+ "entriesEmitted": 0,+ "digest": 2166136261,+ "entitiesVisitedPerSimSecond": 0,+ "fieldComparesPerSimSecond": 0,+ "candidatesPerSimSecond": 0,+ "componentScansSkipped": 1996,+ "recall": {+ "oracleEntries": 0,+ "missed": 0+ },+ "heapAfterWarmupBytes": 21889488,+ "heapDeltaBytes": -4810184,+ "heapSetupBytes": 474648,+ "gcCount": 0,+ "gcMs": 0,+ "wallSeconds": 0.279+ },+ {+ "arm": "C",+ "entities": 1000,+ "dirty": 0.01,+ "simHz": 60,+ "replHz": 20,+ "warmup": 300,+ "measure": 1200,+ "verify": true,+ "timingsComparable": false,+ "simSeconds": 20,+ "writeTaxUsPerSimSecond": 282.74,+ "sampleTaxUsPerSimSecond": 1369.4950000000001,+ "totalTaxUsPerSimSecond": 1652.2350000000001,+ "samples": 400,+ "entriesEmitted": 11998,+ "digest": 2220373607,+ "entitiesVisitedPerSimSecond": 60000,+ "fieldComparesPerSimSecond": 1399.8,+ "candidatesPerSimSecond": 600,+ "componentScansSkipped": 499,+ "recall": {+ "oracleEntries": 14995,+ "missed": 0+ },+ "heapAfterWarmupBytes": 19239416,+ "heapDeltaBytes": -228440,+ "heapSetupBytes": -2067944,+ "gcCount": 0,+ "gcMs": 0,+ "wallSeconds": 0.356+ },+ {+ "arm": "C",+ "entities": 1000,+ "dirty": 1,+ "simHz": 60,+ "replHz": 20,+ "warmup": 300,+ "measure": 1200,+ "verify": true,+ "timingsComparable": false,+ "simSeconds": 20,+ "writeTaxUsPerSimSecond": 12878.985,+ "sampleTaxUsPerSimSecond": 6951.305,+ "totalTaxUsPerSimSecond": 19830.29,+ "samples": 400,+ "entriesEmitted": 1200000,+ "digest": 3153663685,+ "entitiesVisitedPerSimSecond": 60000,+ "fieldComparesPerSimSecond": 140000,+ "candidatesPerSimSecond": 60000,+ "componentScansSkipped": 499,+ "recall": {+ "oracleEntries": 1499640,+ "missed": 0+ },+ "heapAfterWarmupBytes": 20729424,+ "heapDeltaBytes": -1574496,+ "heapSetupBytes": -506728,+ "gcCount": 0,+ "gcMs": 0,+ "wallSeconds": 0.976+ },+ {+ "arm": "C",+ "entities": 10000,+ "dirty": 0,+ "simHz": 60,+ "replHz": 20,+ "warmup": 300,+ "measure": 1200,+ "verify": true,+ "timingsComparable": false,+ "simSeconds": 20,+ "writeTaxUsPerSimSecond": 39.475,+ "sampleTaxUsPerSimSecond": 30.105,+ "totalTaxUsPerSimSecond": 69.58,+ "samples": 400,+ "entriesEmitted": 0,+ "digest": 2166136261,+ "entitiesVisitedPerSimSecond": 0,+ "fieldComparesPerSimSecond": 0,+ "candidatesPerSimSecond": 0,+ "componentScansSkipped": 1996,+ "recall": {+ "oracleEntries": 0,+ "missed": 0+ },+ "heapAfterWarmupBytes": 131966440,+ "heapDeltaBytes": -21082312,+ "heapSetupBytes": 27910240,+ "gcCount": 0,+ "gcMs": 0,+ "wallSeconds": 3.075+ },+ {+ "arm": "C",+ "entities": 10000,+ "dirty": 0.01,+ "simHz": 60,+ "replHz": 20,+ "warmup": 300,+ "measure": 1200,+ "verify": true,+ "timingsComparable": false,+ "simSeconds": 20,+ "writeTaxUsPerSimSecond": 5616.045,+ "sampleTaxUsPerSimSecond": 19253.31,+ "totalTaxUsPerSimSecond": 24869.355,+ "samples": 400,+ "entriesEmitted": 120000,+ "digest": 3022072142,+ "entitiesVisitedPerSimSecond": 600000,+ "fieldComparesPerSimSecond": 14000,+ "candidatesPerSimSecond": 6000,+ "componentScansSkipped": 499,+ "recall": {+ "oracleEntries": 149966,+ "missed": 0+ },+ "heapAfterWarmupBytes": 137262616,+ "heapDeltaBytes": -34370080,+ "heapSetupBytes": 32932576,+ "gcCount": 0,+ "gcMs": 0,+ "wallSeconds": 4.847+ },+ {+ "arm": "C",+ "entities": 10000,+ "dirty": 1,+ "simHz": 60,+ "replHz": 20,+ "warmup": 300,+ "measure": 1200,+ "verify": true,+ "timingsComparable": false,+ "simSeconds": 20,+ "writeTaxUsPerSimSecond": 199513.66999999998,+ "sampleTaxUsPerSimSecond": 93911.865,+ "totalTaxUsPerSimSecond": 293425.53500000003,+ "samples": 400,+ "entriesEmitted": 12000000,+ "digest": 999528389,+ "entitiesVisitedPerSimSecond": 600000,+ "fieldComparesPerSimSecond": 1400000,+ "candidatesPerSimSecond": 600000,+ "componentScansSkipped": 499,+ "recall": {+ "oracleEntries": 14996409,+ "missed": 0+ },+ "heapAfterWarmupBytes": 122183040,+ "heapDeltaBytes": 47206408,+ "heapSetupBytes": 17762224,+ "gcCount": 0,+ "gcMs": 0,+ "wallSeconds": 12.683+ },+ {+ "arm": "C",+ "entities": 100000,+ "dirty": 0.01,+ "simHz": 60,+ "replHz": 20,+ "warmup": 300,+ "measure": 1200,+ "verify": true,+ "timingsComparable": false,+ "simSeconds": 20,+ "writeTaxUsPerSimSecond": 68677.385,+ "sampleTaxUsPerSimSecond": 298838.755,+ "totalTaxUsPerSimSecond": 367516.14,+ "samples": 400,+ "entriesEmitted": 1199996,+ "digest": 658124378,+ "entitiesVisitedPerSimSecond": 6000000,+ "fieldComparesPerSimSecond": 139999.9,+ "candidatesPerSimSecond": 60000,+ "componentScansSkipped": 499,+ "recall": {+ "oracleEntries": 1499635,+ "missed": 0+ },+ "heapAfterWarmupBytes": 627626112,+ "heapDeltaBytes": -30346096,+ "heapSetupBytes": -60965736,+ "gcCount": 0,+ "gcMs": 0,+ "wallSeconds": 63.676+ }+ ],+ "parity": [],+ "recallClean": true+}diff --git a/bench/replication-dirty/run.mjs b/bench/replication-dirty/run.mjsnew file mode 100644index 000000000..447e918ab--- /dev/null+++ b/bench/replication-dirty/run.mjs@@ -0,0 +1,189 @@+// SPDX-License-Identifier: Apache-2.0+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team+/**+ * @file The four-arm dirty-oracle probe. Runs every arm at every workload+ * point in its OWN process, then reports two verdicts that are not the+ * same question:+ *+ * correctness — did the tracker name every change a full scan found?+ * performance — total replication tax per simulated second+ *+ * A failing correctness verdict disqualifies the mechanism whatever the+ * performance says, and the report prints it that way.+ *+ * This probe SHIPS NOTHING. It does not touch the replication layer; it+ * reproduces the production sampling loop so the arms can differ in exactly one+ * mechanism. Deciding what to do about the numbers is a later change.+ *+ * node bench/replication-dirty/run.mjs [--quick]+ */+import { spawnSync } from 'node:child_process';+import { writeFileSync } from 'node:fs';+import os from 'node:os';+import path from 'node:path';+import { fileURLToPath } from 'node:url';++const HERE = path.dirname(fileURLToPath(import.meta.url));+const ROOT = path.resolve(HERE, '..', '..');+const ARM = path.join(HERE, 'arm.mjs');+const QUICK = process.argv.includes('--quick');++const ARMS = ['A', 'B', 'C', 'D'];+const ARM_MEANING = {+ A: 'tracking OFF, full shadow (today\'s production)',+ B: 'tracking ON, full shadow (the write tax, alone)',+ C: 'tracking ON, candidates+verify(the candidate architecture)',+ D: 'tracking ON, candidates only (COUNTERFACTUAL CEILING)',+};+const ENTITY_COUNTS = QUICK ? [1000] : [1000, 10000, 100000];+const DIRTY_RATES = [0, 0.01, 1];+const FIXED = {+ simHz: 60, replHz: 20,+ warmup: QUICK ? 60 : 300,+ measure: QUICK ? 240 : 1200,+};++/**+ * Recall is a logical property of the write paths, not of scale, so it is not+ * run at every point — but it IS run at the target workload's full size, where+ * a scale-dependent surprise would live if there were one.+ */+const VERIFY_POINTS = QUICK+ ? [[1000, 0.01]]+ : [[1000, 0], [1000, 0.01], [1000, 1], [10000, 0], [10000, 0.01], [10000, 1], [100000, 0.01]];++function runPoint(arm, entities, dirty, verify) {+ const args = [+ ARM, '--arm', arm, '--entities', String(entities), '--dirty', String(dirty),+ '--simHz', String(FIXED.simHz), '--replHz', String(FIXED.replHz),+ '--warmup', String(FIXED.warmup), '--measure', String(FIXED.measure),+ ];+ if (verify) args.push('--verify');+ const started = Date.now();+ const run = spawnSync(process.execPath, args, { encoding: 'utf8', cwd: ROOT, maxBuffer: 1 << 24 });+ if (run.status !== 0) {+ console.error(run.stderr || run.stdout);+ throw new Error(`arm ${arm} @ ${entities}/${dirty}${verify ? ' (verify)' : ''} exited ${run.status}`);+ }+ const result = JSON.parse(run.stdout);+ result.wallSeconds = (Date.now() - started) / 1000;+ return result;+}++const points = [];+const total = ENTITY_COUNTS.length * DIRTY_RATES.length * ARMS.length + VERIFY_POINTS.length;+let done = 0;++for (const entities of ENTITY_COUNTS) {+ for (const dirty of DIRTY_RATES) {+ for (const arm of ARMS) {+ process.stderr.write(`[${++done}/${total}] arm ${arm} ${entities} entities ${dirty * 100}% dirty\n`);+ points.push(runPoint(arm, entities, dirty, false));+ }+ }+}++const verifies = [];+for (const [entities, dirty] of VERIFY_POINTS) {+ process.stderr.write(`[${++done}/${total}] recall ${entities} entities ${dirty * 100}% dirty\n`);+ verifies.push(runPoint('C', entities, dirty, true));+}++// ---------------------------------------------------------------------------+// Verdicts+// ---------------------------------------------------------------------------++const at = (arm, entities, dirty) =>+ points.find((p) => p.arm === arm && p.entities === entities && p.dirty === dirty);++const lines = [];+const say = (s = '') => { lines.push(s); console.log(s); };++say('=== four-arm dirty-oracle probe ===');+say(`sim ${FIXED.simHz}Hz · replication ${FIXED.replHz}Hz · warmup ${FIXED.warmup} · measure ${FIXED.measure} ticks`+ + ` · 4 replicated components/entity (3 mutated, 1 static)`);+say('');+for (const arm of ARMS) say(` ${arm} ${ARM_MEANING[arm]}`);+say('');++// --- correctness ---------------------------------------------------------+say('--- CORRECTNESS: did the tracker name every change a full scan found? ---');+let recallClean = true;+for (const v of verifies) {+ const miss = v.recall.missed;+ if (miss > 0) recallClean = false;+ say(` ${String(v.entities).padStart(6)} ent · ${String(v.dirty * 100).padStart(3)}% dirty`+ + ` oracle ${String(v.recall.oracleEntries).padStart(9)} missed ${String(miss).padStart(6)}`+ + ` ${miss === 0 ? 'complete' : 'INCOMPLETE'}`);+}+say('');++// Output parity: A, B and C claim to produce the same replication output.+const parity = [];+for (const entities of ENTITY_COUNTS) {+ for (const dirty of DIRTY_RATES) {+ const a = at('A', entities, dirty), b = at('B', entities, dirty), c = at('C', entities, dirty);+ const same = a.digest === b.digest && a.digest === c.digest;+ if (!same) parity.push({ entities, dirty, a: a.digest, b: b.digest, c: c.digest });+ }+}+say(parity.length === 0+ ? ' output parity A=B=C: identical at every point.'+ : ` output parity A=B=C: DIFFERS at ${parity.length} point(s) — ${JSON.stringify(parity)}`);+say(' (D is excluded: it emits unverified candidates, so a different digest is expected.)');+say('');++// --- performance ---------------------------------------------------------+say('--- PERFORMANCE: total replication tax (µs per simulated second) ---');+say(' write tax + sample tax. GC is inside those wall times already and is');+say(' reported beside them, never added.');+say('');+const pad = (v, w) => String(v).padStart(w);+const round = (v) => Math.round(v);+for (const entities of ENTITY_COUNTS) {+ for (const dirty of DIRTY_RATES) {+ say(` ${entities} entities · ${dirty * 100}% dirty`);+ say(` arm write sample total B/A C/B C/A alloc KB/s GC`);+ const a = at('A', entities, dirty);+ for (const arm of ARMS) {+ const p = at(arm, entities, dirty);+ const ratio = (x, y) => (y > 0 ? (x / y).toFixed(2) : '—');+ const b = at('B', entities, dirty), c = at('C', entities, dirty);+ const cols = arm === 'A' ? ['—', '—', '—']+ : arm === 'B' ? [ratio(p.totalTaxUsPerSimSecond, a.totalTaxUsPerSimSecond), '—', '—']+ : arm === 'C' ? ['—', ratio(p.totalTaxUsPerSimSecond, b.totalTaxUsPerSimSecond), ratio(p.totalTaxUsPerSimSecond, a.totalTaxUsPerSimSecond)]+ : ['—', '—', ratio(p.totalTaxUsPerSimSecond, a.totalTaxUsPerSimSecond)];+ say(` ${arm} ${pad(round(p.writeTaxUsPerSimSecond), 8)} ${pad(round(p.sampleTaxUsPerSimSecond), 11)} ${pad(round(p.totalTaxUsPerSimSecond), 11)}`+ + ` ${pad(cols[0], 6)} ${pad(cols[1], 6)} ${pad(cols[2], 6)}`+ + ` ${pad(round(p.heapDeltaBytes / 1024 / p.simSeconds), 10)} ${pad(p.gcCount, 4)}`);+ }+ say('');+ }+}++say('--- WHAT THE THREE RATIOS ASK ---');+say(' B/A what does turning tracking on cost the WRITE path, alone?');+say(' C/B having paid that, how much scan does candidate pruning save?');+say(' C/A is the whole architecture worth switching production to?');+say('');+say(recallClean+ ? 'RECALL: complete at every point measured.'+ : 'RECALL: INCOMPLETE — the tracker missed changes a full scan found.'+ + ' The candidate path MUST NOT SHIP whatever the timings say.');++// A quick run writes its own file: it is 1k-only and must never be mistaken+// for — or overwrite — the matrix everyone reads.+const out = path.join(HERE, QUICK ? 'results.quick.json' : 'results.json');+// A benchmark artifact that does not say what ran it is a number without units.+const machine = {+ node: process.version,+ platform: `${os.platform()} ${os.release()}`,+ cpu: os.cpus()[0]?.model ?? 'unknown',+ cores: os.cpus().length,+ totalMemGB: Math.round(os.totalmem() / 1024 ** 3),+ ranAt: new Date().toISOString(),+};+writeFileSync(out, `${JSON.stringify({ machine, fixed: FIXED, points, verifies, parity, recallClean }, null, 2)}+`);+say('');+say(`raw results: ${path.relative(ROOT, out)}`);diff --git a/bench/replication-dirty/workload.mjs b/bench/replication-dirty/workload.mjsnew file mode 100644index 000000000..d41939769--- /dev/null+++ b/bench/replication-dirty/workload.mjs@@ -0,0 +1,225 @@+// SPDX-License-Identifier: Apache-2.0+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team+/**+ * @file The one workload every arm runs, and the four ways of finding what+ * changed. Shared so the arms differ in EXACTLY the mechanism under+ * test: the same entities, the same components, the same fields, the+ * same values, on the same ticks.+ *+ * The mutation schedule is a pure function of (tick, entityCount, dirtyRate) —+ * no RNG state, so two processes cannot drift apart. Selection strides by a+ * prime rather than taking a contiguous run, so a scan cannot be flattered by+ * locality the real thing would not have.+ */+import { pathToFileURL } from 'node:url';+import path from 'node:path';++const STRIDE = 7919; // coprime with every entity count used here++/** Load the SDK's headless build from a repo checkout. */+export async function loadSdk(root) {+ const entry = path.join(root, 'sdk', 'dist', 'index.node.js');+ return import(pathToFileURL(entry).href);+}++/**+ * Four replicated components per entity, of which THREE are mutated and one is+ * static — a scan pays for every replicated component whether it moves or not,+ * and a world where everything moves is not the world being modelled.+ */+export function defineWorkloadComponents(sdk) {+ const { defineComponent } = sdk;+ return [+ { def: defineComponent('WlPos', { x: 0, y: 0, z: 0 }, { replicatedFields: ['x', 'y', 'z'] }), fields: ['x', 'y', 'z'], mutated: true },+ { def: defineComponent('WlVitals', { hp: 100, mp: 50 }, { replicatedFields: ['hp', 'mp'] }), fields: ['hp', 'mp'], mutated: true },+ { def: defineComponent('WlMotion', { vx: 0, vy: 0 }, { replicatedFields: ['vx', 'vy'] }), fields: ['vx', 'vy'], mutated: true },+ { def: defineComponent('WlIdent', { team: 0, tag: '' }, { replicatedFields: ['team', 'tag'] }), fields: ['team', 'tag'], mutated: false },+ ];+}++/** Populate a world with `count` entities carrying every workload component. */+export function buildWorld(world, table, count) {+ const entities = new Array(count);+ for (let i = 0; i < count; i++) {+ const e = world.spawn();+ world.insert(e, table[0].def, { x: i, y: 0, z: 0 });+ world.insert(e, table[1].def, { hp: 100, mp: 50 });+ world.insert(e, table[2].def, { vx: 0, vy: 0 });+ world.insert(e, table[3].def, { team: i & 3, tag: 'unit' });+ entities[i] = e;+ }+ return entities;+}++/**+ * Apply one simulation tick's writes. Deterministic in `tick`: the same+ * entities take the same values in every arm, which is what makes the arms+ * comparable at all.+ */+export function applyTick(world, table, entities, tick, dirtyCount) {+ const n = entities.length;+ if (dirtyCount <= 0) return;+ if (dirtyCount >= n) {+ for (let i = 0; i < n; i++) writeOne(world, table, entities, i, tick);+ return;+ }+ // Modulo every step, not one subtraction: STRIDE outruns the smallest entity+ // count here, and an index that walks off the array writes nothing while+ // still reporting the dirty rate it never applied.+ let idx = (tick * STRIDE) % n;+ for (let k = 0; k < dirtyCount; k++) {+ writeOne(world, table, entities, idx, tick);+ idx = (idx + STRIDE) % n;+ }+}++/** One entity's write: one of the three mutable components, values from tick. */+function writeOne(world, table, entities, i, tick) {+ const e = entities[i];+ switch ((tick + i) % 3) {+ case 0: world.set(e, table[0].def, { x: i + tick, y: tick, z: 0 }); break;+ case 1: world.set(e, table[1].def, { hp: 100 - (tick % 97), mp: 50 + (i % 13) }); break;+ default: world.set(e, table[2].def, { vx: (tick % 31) - 15, vy: (i % 17) - 8 }); break;+ }+}++// ---------------------------------------------------------------------------+// Shadow+// ---------------------------------------------------------------------------++/**+ * entity → componentIndex → { field: lastBroadcastValue }, SEEDED as production+ * seeds it at `registerEntity_`: first state ships in the spawn payload, so the+ * first sample owes nothing. An empty shadow instead emits the whole world once+ * and reads as a catastrophic tracker miss that is really the baseline.+ */+export function newShadow(world, entities, table) {+ const shadow = new Map();+ for (const e of entities) {+ const perComp = new Map();+ for (let ci = 0; ci < table.length; ci++) {+ const entry = table[ci];+ if (!world.has(e, entry.def)) continue;+ const data = world.tryGet(e, entry.def);+ const snap = {};+ for (const f of entry.fields) snap[f] = data[f];+ perComp.set(ci, snap);+ }+ shadow.set(e, perComp);+ }+ return shadow;+}++/**+ * Compare one entity's one component against its shadow, updating it. Returns+ * the changed-field mask (0 = nothing moved). This is the production+ * `collectDirty_` inner loop, reproduced so all four arms share it.+ */+function verify(world, entry, ci, e, perComp, out) {+ if (!world.has(e, entry.def)) return 0;+ const data = world.tryGet(e, entry.def);+ let snap = perComp.get(ci);+ if (!snap) { snap = {}; perComp.set(ci, snap); }+ let mask = 0;+ for (let f = 0; f < entry.fields.length; f++) {+ const key = entry.fields[f];+ const value = data[key];+ if (!(key in snap) || snap[key] !== value) {+ mask |= 1 << f;+ snap[key] = value;+ }+ }+ if (mask !== 0) out.push(e, ci, mask);+ return mask;+}++// ---------------------------------------------------------------------------+// The four arms+// ---------------------------------------------------------------------------++/** A/B — every known entity, every replicated component, every field. */+export function sampleFullShadow(world, table, entities, shadow, out) {+ let compares = 0;+ let visited = 0;+ for (let ci = 0; ci < table.length; ci++) {+ const entry = table[ci];+ for (let i = 0; i < entities.length; i++) {+ const e = entities[i];+ visited++;+ compares += entry.fields.length;+ verify(world, entry, ci, e, shadow.get(e), out);+ }+ }+ return { visited, compares };+}++/**+ * C — the tracker names candidates, the shadow still decides. Against the+ * ChangeTracker as it EXISTS: `anyChangedSince` gates a whole component in O(1),+ * but nothing indexes which entities changed, so the per-entity question is+ * still asked once per entity. Inventing that index would measure absent code.+ */+export function sampleTrackedCandidates(world, table, entities, shadow, since, out, recall) {+ let compares = 0;+ let visited = 0;+ let candidates = 0;+ for (let ci = 0; ci < table.length; ci++) {+ const entry = table[ci];+ if (!world.anyChangedSince(entry.def, since)) {+ if (recall) recall.skippedComponents++;+ continue;+ }+ for (let i = 0; i < entities.length; i++) {+ const e = entities[i];+ visited++;+ if (!world.isChangedSince(e, entry.def, since)) continue;+ candidates++;+ compares += entry.fields.length;+ verify(world, entry, ci, e, shadow.get(e), out);+ }+ }+ return { visited, compares, candidates };+}++/** D — candidates trusted outright. COUNTERFACTUAL: it assumes the very thing+ * this probe is investigating. It bounds the ceiling, it justifies nothing. */+export function sampleTrackerOnly(world, table, entities, shadow, since, out) {+ let visited = 0;+ let candidates = 0;+ for (let ci = 0; ci < table.length; ci++) {+ const entry = table[ci];+ if (!world.anyChangedSince(entry.def, since)) continue;+ for (let i = 0; i < entities.length; i++) {+ const e = entities[i];+ visited++;+ if (!world.isChangedSince(e, entry.def, since)) continue;+ candidates++;+ const data = world.tryGet(e, entry.def);+ if (data) out.push(e, ci, (1 << entry.fields.length) - 1);+ }+ }+ return { visited, compares: 0, candidates };+}++// ---------------------------------------------------------------------------+// Output identity+// ---------------------------------------------------------------------------++/**+ * An order-sensitive digest of everything a sample emitted. Arms that claim to+ * produce the same replication output must produce the same number here, and it+ * crosses process boundaries, which in-process comparison cannot.+ */+export class Digest {+ constructor() { this.h = 0x811c9dc5; this.entries = 0; }+ push(entity, ci, mask) {+ this.entries++;+ this.mix(entity); this.mix(ci); this.mix(mask);+ }+ mix(v) {+ let h = this.h ^ (v >>> 0);+ h = Math.imul(h, 0x01000193);+ this.h = h >>> 0;+ }+ get value() { return this.h >>> 0; }+}