SPB Git

Repository Public

report.mjs 6.2 KB 108 lines javascript

1/**2 * =============================================================================3 *                  SP BOUCHER | SOFTWARE & RESEARCH4 *             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5 * =============================================================================6 *7 * Project          : KA Maps Engine8 * File             : sdk/web/scripts/report.mjs9 * Module           : sdk10 * Repository       : https://git.spboucher.ai/ka-maps-engine11 * Created          : 2026-12-0112 * Last Modified    : 2026-12-0113 *14 * Author           : Simon-Pierre Boucher15 * Position         : Professor of Finance16 * Institution      : Université du Québec en Outaouais (UQO)17 * Organization     : SP Boucher18 * Website          : https://spboucher.ai19 * Git              : https://git.spboucher.ai20 *21 * Preferred Contact: support@spboucher.ai22 * Development      : dev@spboucher.ai23 * Support          : support@spboucher.ai24 * Security/Admin   : admin@spboucher.ai25 *26 * Copyright (c) 202627 * Simon-Pierre Boucher28 * All rights reserved where applicable. This file is governed by the29 * applicable project license, copyright notices and relevant law.30 * Existing third-party rights and notices remain unaffected.31 *32 * License          : None specified (no license file in this repository)33 *34 * Do not embed credentials, private keys, access tokens,35 * certificates or confidential personal information.36 *37 * =============================================================================38 * END OF SP BOUCHER SOURCE HEADER39 * =============================================================================40 */4142// Met en forme les mesures des essais (test-results/perf/*.json, test-results/soak/*.json,43// test-results/report.json, dist/sizes.json) en tableaux Markdown, à reporter dans44// docs/PERFORMANCE_BENCHMARKS.md et docs/TEST_REPORT.md. N'invente rien : une mesure absente est omise.45//46//   node scripts/report.mjs47import { existsSync, readdirSync, readFileSync } from 'node:fs';4849const read = (p) => JSON.parse(readFileSync(p, 'utf8'));50const dir = (d) => (existsSync(d) ? readdirSync(d).filter((f) => f.endsWith('.json')).map((f) => read(`${d}/${f}`)) : []);51const order = ['chromium-webgpu', 'chromium-webgl2', 'firefox', 'webkit', 'chromium-webgpu-libre', 'chromium-webgl2-libre', 'chromium-webgpu-libre-retina', 'chromium-webgl2-libre-retina'];52const byOrder = (a, b) => order.indexOf(a.project) - order.indexOf(b.project);5354if (existsSync('dist/sizes.json')) {55  const s = read('dist/sizes.json');56  const mb = (n) => (n / 1e6).toFixed(2);57  console.log(`### Tailles (@ka/maps ${s.version})\n`);58  console.log('| Fichier | Brut | gzip -9 | brotli -q 11 |\n|---|---|---|---|');59  console.log(`| \`km_wasm_bg.wasm\` | ${mb(s.wasm.raw)} Mo | ${mb(s.wasm.gzip)} Mo | ${mb(s.wasm.brotli)} Mo |`);60  console.log(`| \`ka-maps-worker.js\` | ${(s.worker.raw / 1000).toFixed(0)} ko | | |\n`);61}6263const perf = dir('test-results/perf').sort(byOrder);64if (perf.length) {65  console.log('### Chargement\n');66  console.log('| Navigateur | Moteur | Prêt à froid | Prêt à chaud | Binaire (réseau + compilation) | Création de la carte | Tuiles | Construction moyenne d’une tuile |\n|---|---|---|---|---|---|---|---|');67  for (const p of perf.filter((p) => !p.project.includes('-libre'))) {68    console.log(`| ${p.project} | ${p.cold.backend} | ${p.coldReadyMs} ms | ${p.warmReadyMs} ms | ${p.cold.engineLoadMs} ms | ${p.cold.createMs} ms | ${p.cold.tilesFetched} (${(p.cold.tileBytes / 1e6).toFixed(1)} Mo) | ${p.cold.avgBuildMs} ms |`);69  }70  console.log('\n### Cadence\n');71  console.log('| Navigateur | 2D (trames/s) | CPU par trame | 3D (trames/s) | CPU par trame | 3D + 8 couches (trames/s) | CPU par trame | Triangles (3D + couches) |\n|---|---|---|---|---|---|---|---|');72  for (const p of perf) {73    console.log(`| ${p.project} (${p.cold.canvas.join(' × ')} px) | ${p.fps2d.fps} | ${p.fps2d.frameCpuMs} ms | ${p.fps3d.fps} | ${p.fps3d.frameCpuMs} ms | ${p.fps3dLayers.fps} | ${p.fps3dLayers.frameCpuMs} ms | ${(p.fps3dLayers.triangles / 1000).toFixed(0)} k |`);74  }75  console.log('\n### Mémoire en fin de scénario de mesure\n');76  console.log('| Navigateur | wasm | Tas JS | GPU (estimation du moteur) |\n|---|---|---|---|');77  for (const p of perf.filter((p) => !p.project.includes('-libre'))) console.log(`| ${p.project} | ${p.memory.wasmMb} Mo | ${p.memory.jsHeapMb ?? '—'}${p.memory.jsHeapMb ? ' Mo' : ''} | ${p.memory.gpuEstimateMb} Mo |`);78  console.log(`\nCanvas ${perf[0].cold.canvas.join(' × ')} px, densité ${perf[0].cold.dpr}. ${perf[0].cold.userAgent}`);79}8081const soak = dir('test-results/soak').sort(byOrder);82if (soak.length) {83  console.log('\n### Endurance mémoire\n');84  console.log('| Navigateur | Durée | Étapes | wasm : début → max tiers médian → max dernier tiers | Tas JS : début → médian → dernier | GPU estimé : médian → dernier | Tuiles évincées |\n|---|---|---|---|---|---|---|');85  for (const s of soak) {86    console.log(`| ${s.project} | ${s.minutes} min | ${s.steps} | ${s.wasm.first} → ${s.wasm.midMax} → ${s.wasm.lastMax} Mo | ${s.jsHeap ? `${s.jsHeap.first} → ${s.jsHeap.midMax} → ${s.jsHeap.lastMax} Mo` : 'non mesurable'} | ${s.gpuEstimate.midMax} → ${s.gpuEstimate.lastMax} Mo | ${s.tilesEvicted} |`);87  }88}8990if (existsSync('test-results/report.json')) {91  const r = read('test-results/report.json');92  const tally = {};93  const walk = (suite) => {94    for (const spec of suite.specs ?? []) for (const t of spec.tests ?? []) {95      const k = t.projectName;96      tally[k] ??= { passed: 0, failed: 0, skipped: 0, flaky: 0 };97      const st = t.status === 'expected' ? 'passed' : t.status === 'skipped' ? 'skipped' : t.status === 'flaky' ? 'flaky' : 'failed';98      tally[k][st]++;99    }100    for (const s of suite.suites ?? []) walk(s);101  };102  for (const s of r.suites ?? []) walk(s);103  console.log('\n### Essais de bout en bout (dernière exécution)\n');104  console.log('| Projet | Réussis | Échoués | Instables | Ignorés |\n|---|---|---|---|---|');105  for (const k of Object.keys(tally).sort((a, b) => order.indexOf(a) - order.indexOf(b))) console.log(`| ${k} | ${tally[k].passed} | ${tally[k].failed} | ${tally[k].flaky} | ${tally[k].skipped} |`);106  console.log(`\nDurée : ${(r.stats.duration / 1000).toFixed(0)} s, ${r.stats.startTime}.`);107}108
Files main
Menu

Theme