const fs=require('fs'),assert=require('assert/strict'); const before=JSON.parse(fs.readFileSync('backend/reports/repository-runtime-comparison.json')); const after=JSON.parse(fs.readFileSync('backend/reports/repository-runtime-comparison-after.json')); const median=a=>{a=[...a].sort((a,b)=>a-b);return (a[Math.floor((a.length-1)/2)]+a[Math.floor(a.length/2)])/2}; const summary=after.results[0].results.map(x=>{ const row={name:x.name}; for(const [label,report,runtime] of [['ts',after,'node'],['goBefore',before,'go'],['goAfter',after,'go']]){ const runs=report.results.filter(x=>x.runtime===runtime).map(run=>run.results.find(y=>y.name===row.name)); assert(runs.every(x=>x.output.status===200)); row[label]={output:runs[0].output,coldMs:median(runs.map(x=>x.cold.ms)),warm:Object.fromEntries([1,8].map(c=>[c,Object.fromEntries(['p50Ms','p95Ms','cpuMs','peakProcessTreeRssBytes','requestsPerSecond'].map(m=>[m,median(runs.map(x=>x.warm.find(w=>w.concurrency===c)[m]))]))]))}; } assert.deepEqual(row.ts.output,row.goBefore.output);assert.deepEqual(row.ts.output,row.goAfter.output); return row; }); const report={fixture:after.fixture,method:after.method,validation:{outputs:'All seven response signatures match TypeScript, Go before and Go after in both rounds.',tests:['Targeted race suites passed: large tree scans, index parity/eviction/collisions, website lookup, shared HTTP authorization and representations.','go vet passed.']},summary}; fs.writeFileSync('backend/reports/slower-path-optimization.json',JSON.stringify(report,null,2)); const html=`
Same repository snapshot and 1,000-file directory fixture. Both runtimes rerun in alternating order; all seven successful response signatures still match.
| Use case | TypeScript | Go before | Go after |
|---|
| Use case | TypeScript | Go before | Go after |
|---|
Counts now aggregate by directory in MongoDB. Website files use verified direct lookups or a collision-aware path index, with live snapshot and authorization checks.
Loopback backend timings, identity encoding, shared caches enabled, one worker. Two rounds; medians of per-round medians. Excludes GitHub, CDN and browser rendering. First masked/custom-path requests can still build an index. ZIP was not rerun because these changes do not alter its serving path.
`; fs.writeFileSync('backend/reports/slower-path-optimization.html',html); console.log(JSON.stringify(summary.filter(x=>['file counts','website gulpfile.js'].includes(x.name)),null,2));