Merge upstream: Lambda Bazaar, traffic badges, moving customers and faster routing (3.3.0)
Some checks are pending
CI / plan (push) Waiting to run
CI / part (push) Blocked by required conditions
CI / build (push) Waiting to run
CI / translations (push) Waiting to run
CI / test (push) Blocked by required conditions
CI / timings (push) Blocked by required conditions
Container image / gate (push) Waiting to run
Container image / test (push) Blocked by required conditions
Container image / publish (push) Blocked by required conditions
Some checks are pending
CI / plan (push) Waiting to run
CI / part (push) Blocked by required conditions
CI / build (push) Waiting to run
CI / translations (push) Waiting to run
CI / test (push) Blocked by required conditions
CI / timings (push) Blocked by required conditions
Container image / gate (push) Waiting to run
Container image / test (push) Blocked by required conditions
Container image / publish (push) Blocked by required conditions
CHANGELOG.md: upstream's released sections as they are; main's 11 Unreleased bullets kept under Unreleased. scripts/lib/route-fuzz.js: upstream's skip of dashboard tabs the base lacks, plus main's trimming of args the base's buttons lack. src/game/10-catalog/40-ports.js: upstream's one-pass portsAt(); an express still takes ports per channel at its ends. src/game/10-catalog/60-reach-and-subsea.js: upstream's dfLit/dfCap0/dfOn (managed waves carved out); capOf() keeps xp and sat. src/game/60-features/80-new-game.js: upstream's vol and cm in a new game, with main's ip4, rgen, mp and saved-shape fields. src/game/60-features/95-standing-orders.js: upstream's portsAt, cachePlan and promiseCheck, inside main's build-standard routers order, optup marks, opsDarkPre and decom gone list; opsPairs still leaves satellites out. src/game/80-simulation/30-compute.js: upstream's routing core; main's satellite edges (SATN) pass into it, express risks and sat/ip4 money stay. src/game/80-simulation/29-route-core.js: main's satellite latency note moved into the core, where upstream moved the flow loop. src/game/80-simulation/40-billing.js: main's linkCut() and xp/sat in linkDown(), with upstream's dfOn(). src/game/80-simulation/50-sanitize.js: upstream's cmClean listings and cmFix/volFix; main keeps the xp/sat kinds, mpSanitize, ip4Fix and satSanitize. src/game/80-simulation/60-requirements.js: upstream's shared diversity graph; an express link carries the list of trenches it rides. src/game/91-save.js: upstream's saves in the worker, except a multiplayer session network, whose text is made on the page (mpSave) so the server gets the very save the slot holds; bootNotes() kept. src/game/91-slots.js: upstream's slot text and day, with main's mp badge on a slot. src/game/93-ui/70-link-panels.js: a fiber says both its managed waves and the expresses it carries. src/game/94-dashboard/60-dashboard.js: upstream's carried tile, main's themed demand line. src/game/95-modals/70-link-modal.js: main's Express tab, then upstream's hint for a coast no cable lands on (#321). After the merge: - Moving a circuit: a path over an express shares the trenches of the fibers it rides, so it is never called fully diverse from a path along them (test in express-fiber). - The capacity market and moving customers leave the slots expresses hold (test in express-fiber; no code change needed). - The NOC log keeps only the kinds a reload keeps: the market's info/warn news is a plain line, live as after a reload. - New acts classified for server-run play: market and path moves sent, marketOpen and pathOpen local; pathPin's path may be longer than 64 characters. - Server-play fixtures written again (new cm and vol fields); the dark-mode test reads mapStill()'s three states. - A big multiplayer network that moved on still pushes its save to the server (test in multiplayer). - The full suite ran on jsdom 31.0.0 and playwright-core 1.65.0, the versions the merged lockfile pins.
This commit is contained in:
commit
61e31c53d3
105 changed files with 3281 additions and 664 deletions
|
|
@ -87,6 +87,9 @@ const SEND = [
|
|||
'metricMode',
|
||||
'metricSet',
|
||||
'mkBanana',
|
||||
'mktCfg',
|
||||
'mktHold',
|
||||
'mktRoute',
|
||||
'myIxUp',
|
||||
'opsCap',
|
||||
'opsFire',
|
||||
|
|
@ -99,6 +102,9 @@ const SEND = [
|
|||
'opsTpl',
|
||||
'orderCable',
|
||||
'orderDf',
|
||||
'pathAuto',
|
||||
'pathMove',
|
||||
'pathPin',
|
||||
'peer',
|
||||
'peerAll',
|
||||
'peerPol',
|
||||
|
|
@ -242,6 +248,7 @@ const LOCAL = [
|
|||
'logAll',
|
||||
'logOpen',
|
||||
'mapSet',
|
||||
'marketOpen',
|
||||
'meetGo',
|
||||
'menu',
|
||||
'modeSet',
|
||||
|
|
@ -268,6 +275,7 @@ const LOCAL = [
|
|||
'opsCity',
|
||||
'opsOpen',
|
||||
'ownCab',
|
||||
'pathOpen',
|
||||
'phoneTab',
|
||||
'pickHome',
|
||||
'pickStart',
|
||||
|
|
@ -443,6 +451,8 @@ const DRAFT_TYPES = {
|
|||
// Args longer than the envelope's 64 characters: their own cap (the game cuts the texts shorter itself).
|
||||
const TEXT = {
|
||||
metricSet: { v: 16 },
|
||||
// A pinned path's cities, comma-separated: a long path is longer than 64 characters.
|
||||
pathPin: { via: 1024 },
|
||||
pieRename: { name: 64 },
|
||||
renameGo: { name: 64 },
|
||||
teCheck: { script: 4000 },
|
||||
|
|
|
|||
|
|
@ -55,8 +55,8 @@ const TABS = ['cust', 'up', 'peer', 'links'];
|
|||
const LEFT = ['nets', 'noc', 'deals', 'goals'];
|
||||
const PRESETS = ['freeze', 'oncall', 'bgp'];
|
||||
// How often a button is pressed against the others on screen: what changes the network often, looking around rarely.
|
||||
const BUILD = /^(buy\w*|pni\w*All|pni|peer|peerAll|unpeer|cache|cacheSite|rmCache|buildLink|buildPop|launchBB|accept|decline|dropBiz|takeLoan|repayLoan|lag[TPI]x?|setPref|setCarry|setStandby|setMetric|togglePrem|cleanPipe|sacrif|rs|foundIx|myIxUp|addRouter|rmRouter|upRouter|addSite|rmSite|siteSet|decomToggle|rmLink|upLink|addParallel|cancel\w*|upVxc|buyNni|rmNni|buildScrub|scrubUp|rmScrub|addGen|regen|addCh|rmCh|addPair|upSys|spares|layShip|crews|fixInc|seaPackage|subUpgrade|orderCable|orderDf|ownCab|opsHire|opsToggle|opsParam|opsCap|opsPop|opsTpl|opsNewPop|popStdSet|coreSet|teRecipe|dkOptOut|dkStay|utility\w*|listFiber|unlistFiber|leaseSwap|custGo|confGo|confSponsor|seatBuy|charter|cnPrem|applyCn|ad|ddosAuto|pz(Pop|RmPop|Link|AddPar|Tier|RmLink|RtAdd|RtRm|RtModel|Route|Via|Div)|setRoute|route|via|metricSet)$/;
|
||||
const UIACT = /^(tab|dashTab|leftTab|\w*Sort|\w*Filter|pniGrp|trace\w*|focusCity|findGo|selLink|dashLink|logAll|tailTog|listMore|netFocus|netFilter|meetGo|phoneTab|dashClose|connF|connCity|connNet|connFor|custF|custCity|popGo|popsReg|opsOpen|decomOpen|linkCheck)$/;
|
||||
const BUILD = /^(buy\w*|pni\w*All|pni|peer|peerAll|unpeer|cache|cacheSite|rmCache|buildLink|buildPop|launchBB|accept|decline|dropBiz|pathMove|pathPin|pathAuto|takeLoan|repayLoan|lag[TPI]x?|setPref|setCarry|setStandby|setMetric|togglePrem|cleanPipe|sacrif|rs|foundIx|myIxUp|addRouter|rmRouter|upRouter|addSite|rmSite|siteSet|decomToggle|rmLink|upLink|addParallel|cancel\w*|upVxc|buyNni|rmNni|buildScrub|scrubUp|rmScrub|addGen|regen|addCh|rmCh|addPair|upSys|spares|layShip|crews|fixInc|seaPackage|subUpgrade|orderCable|orderDf|ownCab|opsHire|opsToggle|opsParam|opsCap|opsPop|opsTpl|opsNewPop|popStdSet|coreSet|teRecipe|dkOptOut|dkStay|utility\w*|listFiber|unlistFiber|leaseSwap|custGo|confGo|confSponsor|seatBuy|charter|cnPrem|applyCn|ad|ddosAuto|pz(Pop|RmPop|Link|AddPar|Tier|RmLink|RtAdd|RtRm|RtModel|Route|Via|Div)|setRoute|route|via|metricSet)$/;
|
||||
const UIACT = /^(tab|dashTab|leftTab|\w*Sort|\w*Filter|pniGrp|trace\w*|focusCity|findGo|selLink|dashLink|logAll|tailTog|listMore|netFocus|netFilter|meetGo|phoneTab|dashClose|connF|connCity|connNet|connFor|custF|custCity|popGo|popsReg|opsOpen|decomOpen|linkCheck|pathOpen)$/;
|
||||
const DW = { launchBB: 4, accept: 4, buyTransit: 3, pni: 3, buyIx: 3, setPref: 4, cache: 2, peerAll: 2, setCarry: 2, takeLoan: 2 };
|
||||
const weight = (b) => (BUILD.test(b.act) ? 8 : UIACT.test(b.act) ? 0.3 : 1);
|
||||
|
||||
|
|
@ -64,6 +64,13 @@ const weight = (b) => (BUILD.test(b.act) ? 8 : UIACT.test(b.act) ? 0.3 : 1);
|
|||
opts: moves (count, default 50 to 200 by seed), maxDays per day-move, onMove(i, move) */
|
||||
function playGame(pages, seed, opts = {}) {
|
||||
const { base, head } = pages;
|
||||
// A badge only this checkout has would unlock in its game alone, and an unlock writes a log line, which shifts every
|
||||
// id made after it: the comparison is about routing, so the new badges are taken off this checkout's page.
|
||||
if (!pages.badges && base !== head) {
|
||||
const ids = base.ev('JSON.stringify(BADGES.map((b)=>b.id))');
|
||||
head.ev(`{const keep=new Set(${ids});for(let i=BADGES.length-1;i>=0;i--)if(!keep.has(BADGES[i].id))BADGES.splice(i,1);}`);
|
||||
pages.badges = true;
|
||||
}
|
||||
const r = rng(seed * 2654435761);
|
||||
const both = (fn, ...a) => [base.call(fn, ...a), head.call(fn, ...a)];
|
||||
const L = base.call('lists');
|
||||
|
|
@ -107,14 +114,16 @@ function playGame(pages, seed, opts = {}) {
|
|||
|
||||
// A screen's buttons on both pages; the same list or a divergence.
|
||||
// Buttons for actions main's page does not have (a new feature's) are left out: the driver only presses what both have.
|
||||
// So are the switches and dials of a standing order this checkout retired (main's sheet still shows them).
|
||||
let baseActs = null, retired = null;
|
||||
// So are the switches and dials of a standing order this checkout retired (main's sheet still shows them), and a
|
||||
// dashboard tab main's page does not have yet.
|
||||
let baseActs = null, retired = null, baseTabs = null;
|
||||
const screen = (w) => { const [a0, b0] = both('screen', w); baseActs = baseActs || new Set(base.call('acts'));
|
||||
if (!retired) { const [o1, o2] = both('sKeys'); retired = new Set(o1.orders.filter((k) => !o2.orders.includes(k))); }
|
||||
const a = Array.isArray(a0) ? a0.filter((x) => !(/^ops/.test(x.act) && retired.has(x.args && x.args.k))) : a0;
|
||||
// Args only this checkout's buttons carry (the total or plan a window shows: pniAll's q, bstdApply's quote) are left
|
||||
// out as well: the driver presses the base's button, which both pages take as before.
|
||||
const b = Array.isArray(b0) ? b0.filter((x) => baseActs.has(x.act)).map((x, i) => { const y = Array.isArray(a) && a[i] && a[i].act === x.act ? a[i].args : null;
|
||||
if (!baseTabs) baseTabs = new Set(JSON.parse(base.ev('JSON.stringify(DTABS)')));
|
||||
const b = Array.isArray(b0) ? b0.filter((x) => baseActs.has(x.act) && !(x.act === 'dashTab' && x.args && !baseTabs.has(x.args.k))).map((x, i) => { const y = Array.isArray(a) && a[i] && a[i].act === x.act ? a[i].args : null;
|
||||
return y && x.args && typeof x.args === 'object' && typeof y === 'object' ? { act: x.act, args: Object.fromEntries(Object.entries(x.args).filter(([k]) => k in y)) } : x; }) : b0;
|
||||
same('buttons of ' + JSON.stringify(w), a, b); return a || []; };
|
||||
const press = (b, where) => { acts[b.act] = (acts[b.act] || 0) + 1; const [e1, e2] = both('press', b); same('press ' + where, e1, e2); note(where + ' ' + b.act + JSON.stringify(b.args) + (e1 ? ' !' + e1 : '')); };
|
||||
|
|
|
|||
|
|
@ -43,6 +43,11 @@ const METRICS = [
|
|||
['panels', 'Side panel and left list', "for(const f of [true,false]){UI.sel={type:'city',id:f?'fra':'ams'};UI.tab=f?'peer':'up';UI.left=f?'nets':'noc';UI.leftOpen=true;renderPanel();renderLeft();}"],
|
||||
['dash', 'NOC dashboard tabs', "$('dash').hidden=false;for(const k of ['overview','conn','traffic','infra','cust']){UI.dtab=k;renderDash();}$('dash').hidden=true"],
|
||||
['map', 'Map at three zoom levels', "for(const z of [1,3.2,7]){cam.x=CITY.fra.x;cam.y=CITY.fra.y;cam.z=z;draw(0);}"],
|
||||
// The NOC intern runs every order, every day: one shift, its recomputes included (hired here if the save has none).
|
||||
['ops', "The NOC intern's shift: opsDay()", "if(!S.ops.intern){S.ops.intern='tracy';S.ops.hired=S.day;for(const k in S.ops.on)S.ops.on[k]=true;S.ops.floor=0;for(const k in S.ops.cap)S.ops.cap[k]=0;}S.cash=1e9;opsDay(S.day)"],
|
||||
// A day as it is played: its routing in the route worker, and only the time it holds the page counted (what a player
|
||||
// feels as a hitch). Chromium only: jsdom has no Worker. See perf-browser.js.
|
||||
['play', 'One game day in play: page time only', null, { play: true }],
|
||||
];
|
||||
|
||||
function open(file) {
|
||||
|
|
@ -57,13 +62,14 @@ function open(file) {
|
|||
}
|
||||
|
||||
const median = (a) => { const s = [...a].sort((x, y) => x - y); return s.length % 2 ? s[(s.length - 1) / 2] : (s[s.length / 2 - 1] + s[s.length / 2]) / 2; };
|
||||
const ms = (x) => x >= 100 ? x.toFixed(0) : x >= 10 ? x.toFixed(1) : x.toFixed(2);
|
||||
const ms = (x) => x == null ? '–' : x >= 100 ? x.toFixed(0) : x >= 10 ? x.toFixed(1) : x.toFixed(2);
|
||||
|
||||
(async () => {
|
||||
const head = open(HEAD), base = BASE ? open(BASE) : null;
|
||||
const sameOutcome = base ? base.outcome() === head.outcome() : null;
|
||||
const res = {};
|
||||
for (const [k, , body] of METRICS) {
|
||||
for (const [k, , body, o] of METRICS) {
|
||||
if (o && o.play) { res[k] = { head: null, base: null, samples: null }; continue; }
|
||||
const h = [], b = [];
|
||||
for (const v of [head, base].filter(Boolean)) { v.time(body); v.time(body); } // warm up
|
||||
for (let i = 0; i < RUNS; i++) {
|
||||
|
|
@ -78,7 +84,7 @@ const browser = args.includes('--browser') ? await require('./perf-browser').run
|
|||
const { mannWhitneyP } = require('./perf-stats');
|
||||
const pOf = (r) => (r.samples && r.samples.base ? mannWhitneyP(r.samples.head, r.samples.base) : 1);
|
||||
const verdict = (r, noise = 2) => {
|
||||
if (r.base == null) return '';
|
||||
if (r.base == null || r.head == null) return '';
|
||||
const ratio = r.head / (r.base || 1e-9);
|
||||
if (Math.abs(r.head - r.base) < noise || pOf(r) >= 0.01) return '≈';
|
||||
if (ratio >= 1.5) return '🔴 slower';
|
||||
|
|
@ -86,8 +92,8 @@ const verdict = (r, noise = 2) => {
|
|||
if (ratio <= 0.85) return '🟢 faster';
|
||||
return '≈';
|
||||
};
|
||||
const pct = (r) => r.base == null ? '' : `${r.head >= r.base ? '+' : ''}${(((r.head - r.base) / (r.base || 1e-9)) * 100).toFixed(0)}%`;
|
||||
const pTxt = (r) => { const p = pOf(r); return p < 0.001 ? '<0.001' : p.toFixed(p < 0.1 ? 3 : 2); };
|
||||
const pct = (r) => r.base == null || r.head == null ? '' : `${r.head >= r.base ? '+' : ''}${(((r.head - r.base) / (r.base || 1e-9)) * 100).toFixed(0)}%`;
|
||||
const pTxt = (r) => { if (r.base == null || r.head == null) return ''; const p = pOf(r); return p < 0.001 ? '<0.001' : p.toFixed(p < 0.1 ? 3 : 2); };
|
||||
// One table per environment, all the same shape. `noise` is the absolute floor below which nothing counts.
|
||||
const table = (res, noise) => (base ? '| What | Base | This PR | Change | p | |\n|---|--:|--:|--:|--:|---|\n' : '| What | Time |\n|---|--:|\n') +
|
||||
METRICS.map(([k, label]) => { const r = res[k]; return base ? `| ${label} | ${ms(r.base)} | ${ms(r.head)} | ${pct(r)} | ${pTxt(r)} | ${verdict(r, noise)} |` : `| ${label} | ${ms(r.head)} |`; }).join('\n') + '\n';
|
||||
|
|
@ -95,7 +101,7 @@ const slowIn = (res, noise) => METRICS.filter(([k]) => /slower/.test(verdict(res
|
|||
|
||||
const s = head.size;
|
||||
let md = `## Performance on a big network\n\n${s.pops} POPs · ${s.links} links · ${s.pni} PNIs · ${s.caches} cache boxes · ${s.ix} IX ports · ${s.customers} customers. Median of ${RUNS} runs, in milliseconds.\n\n`;
|
||||
md += `### Headless (jsdom)\n\nOur JavaScript only: jsdom has no layout and its DOM is far slower than a browser's, so trust the routing rows most here.\n\n` + table(res, 2);
|
||||
md += `### Headless (jsdom)\n\nOur JavaScript only: jsdom has no layout and its DOM is far slower than a browser's, so trust the routing rows most here. It has no Worker either: a day in play is timed in Chromium only.\n\n` + table(res, 2);
|
||||
const slow = base ? slowIn(res, 2) : [];
|
||||
const { PROFILES } = browser ? require('./perf-browser') : { PROFILES: [] };
|
||||
for (const p of PROFILES) {
|
||||
|
|
|
|||
|
|
@ -45,7 +45,23 @@ async function openPage(browser, profile, file, save, errors) {
|
|||
const t = performance.now(); f(); void document.documentElement.offsetHeight;
|
||||
const gl = G && G.shown && G.gl; if (gl) gl.readPixels(0, 0, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, px); else map.getImageData(0, 0, 1, 1);
|
||||
return { ms: performance.now() - t, map: G && G.shown ? 'gl' : '2d' }; }, [k, body]); };
|
||||
return { ctx, time };
|
||||
// One game day as it is played: its steps on the page, its routing in the route worker (built from the page itself,
|
||||
// see 28-route-worker.js). Only the time it holds the page counts: starting the day, each answer from the worker and
|
||||
// each step that waited for a frame. Waiting for the worker does not count; the page is free meanwhile.
|
||||
// null when this page has no worker to play with.
|
||||
const play = async () => { await cdp.send('HeapProfiler.collectGarbage'); return page.evaluate(async () => {
|
||||
window.__TUBES_TEST__ = false;
|
||||
try {
|
||||
const w = typeof rwOn === 'function' && rwOn() && rwStart(); if (!w) return null;
|
||||
let busy = 0; const wrap = (f) => function (...a) { const t = performance.now(); try { return f.apply(this, a); } finally { busy += performance.now() - t; } };
|
||||
const om = w.onmessage, later = RW.later; w.onmessage = wrap(om); if (later) RW.later = (f) => later(wrap(f));
|
||||
S.nextFail = S.nextEvent = S.day + 99;
|
||||
try { const t = performance.now(); rwDay(); busy += performance.now() - t; while (RW.job) await new Promise((r) => setTimeout(r, 1)); }
|
||||
finally { w.onmessage = om; if (later) RW.later = later; }
|
||||
return RW.dead ? null : busy;
|
||||
} finally { window.__TUBES_TEST__ = true; }
|
||||
}); };
|
||||
return { ctx, time, play };
|
||||
}
|
||||
|
||||
// Returns {version, profiles: {desktop: {compute: {head, base}, ...}, phone: {...}}, errors}.
|
||||
|
|
@ -61,14 +77,17 @@ async function runBrowser({ head, base, save, metrics, runs, exe }) {
|
|||
const res = out.profiles[p.key] = {};
|
||||
// Which map each version drew with, over all the runs that drew one (a version falling back mid-run shows both).
|
||||
const maps = res.maps = { head: new Set(), base: new Set() };
|
||||
for (const [k, , body] of metrics) {
|
||||
const H = [], B = [], go = async (v, into, m) => { const r = await v.time(k, body); into.push(r.ms); if (k === 'map') m.add(r.map); };
|
||||
for (const v of [h, b].filter(Boolean)) { await v.time(k, body); await v.time(k, body); } // warm up
|
||||
for (const [k, , body, o] of metrics) {
|
||||
const H = [], B = [], run = (v) => (o && o.play ? v.play() : v.time(k, body));
|
||||
const go = async (v, into, m) => { const r = await run(v); if (o && o.play) into.push(r); else { into.push(r.ms); if (k === 'map') m.add(r.map); } };
|
||||
for (const v of [h, b].filter(Boolean)) { await run(v); await run(v); } // warm up (and the worker starts)
|
||||
for (let i = 0; i < runs; i++) {
|
||||
// Alternate who goes first, like the jsdom runs.
|
||||
if (b && i % 2) { await go(b, B, maps.base); await go(h, H, maps.head); } else { await go(h, H, maps.head); if (b) await go(b, B, maps.base); }
|
||||
}
|
||||
res[k] = { head: median(H), base: b ? median(B) : null, samples: { head: H.map((x) => +x.toFixed(1)), base: b ? B.map((x) => +x.toFixed(1)) : null } };
|
||||
// A version without a worker gives nothing to compare.
|
||||
const ok = (a) => a.every((x) => x != null);
|
||||
res[k] = { head: ok(H) ? median(H) : null, base: b && ok(B) ? median(B) : null, samples: { head: ok(H) ? H.map((x) => +x.toFixed(1)) : null, base: b && ok(B) ? B.map((x) => +x.toFixed(1)) : null } };
|
||||
}
|
||||
res.maps = { head: [...maps.head], base: b ? [...maps.base] : null };
|
||||
await h.ctx.close(); if (b) await b.ctx.close();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue