T04: adversarial review round + survey corrections + ADR-0002 (reimplement, assimilate patterns)
This commit is contained in:
parent
a7e31d4210
commit
53c1b18ec1
7 changed files with 414 additions and 94 deletions
|
|
@ -10,6 +10,8 @@ const { Stage } = require('boardgame.io/core');
|
|||
const crypto = require('crypto');
|
||||
|
||||
const NUM_MOVES = parseInt(process.argv[2] || '100000', 10);
|
||||
const DISABLE_UNDO = process.argv.includes('--disable-undo');
|
||||
const SINGLE_RUN = process.argv.includes('--single-run'); // isolated memory measurement
|
||||
const NUM_PLAYERS = 3;
|
||||
|
||||
const SyntheticGround = {
|
||||
|
|
@ -51,7 +53,7 @@ const SyntheticGround = {
|
|||
|
||||
function makeClient(seed) {
|
||||
return Client({
|
||||
game: { ...SyntheticGround, seed },
|
||||
game: { ...SyntheticGround, seed, disableUndo: DISABLE_UNDO },
|
||||
numPlayers: NUM_PLAYERS,
|
||||
playerID: '0',
|
||||
});
|
||||
|
|
@ -89,13 +91,14 @@ function run(seed, numMoves, collectHash) {
|
|||
}
|
||||
|
||||
// --- throughput ---
|
||||
const warm = run(42, Math.min(NUM_MOVES, 5000), false); // warmup/JIT
|
||||
if (!SINGLE_RUN) run(42, Math.min(NUM_MOVES, 5000), false); // warmup/JIT
|
||||
const main = run(42, NUM_MOVES, true);
|
||||
const memAfterMain = process.memoryUsage();
|
||||
|
||||
// --- determinism: same seed twice, different seed once ---
|
||||
const detA = run(7, 4000, true);
|
||||
const detB = run(7, 4000, true);
|
||||
const detC = run(8, 4000, true);
|
||||
const detA = SINGLE_RUN ? {hash: 'skipped'} : run(7, 4000, true);
|
||||
const detB = SINGLE_RUN ? {hash: 'skipped'} : run(7, 4000, true);
|
||||
const detC = SINGLE_RUN ? {hash: 'x'} : run(8, 4000, true);
|
||||
|
||||
// --- memory ---
|
||||
const mem = process.memoryUsage();
|
||||
|
|
@ -112,5 +115,8 @@ const result = {
|
|||
determinism_diff_seed_differs: detA.hash !== detC.hash,
|
||||
rss_mb: Math.round(mem.rss / 1048576),
|
||||
heap_mb: Math.round(mem.heapUsed / 1048576),
|
||||
rss_after_main_mb: Math.round(memAfterMain.rss / 1048576),
|
||||
disable_undo: DISABLE_UNDO,
|
||||
single_run: SINGLE_RUN,
|
||||
};
|
||||
console.log(JSON.stringify(result, null, 2));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue