fork of hey-api/openapi-ts because I need some additional things
at feat/skip-token 24 lines 768 B view raw
1import fs from 'node:fs'; 2import path from 'node:path'; 3import { fileURLToPath } from 'node:url'; 4 5const __filename = fileURLToPath(import.meta.url); 6const __dirname = path.dirname(__filename); 7 8// Load your exported graph 9const nodes = JSON.parse(fs.readFileSync(path.resolve(__dirname, 'graph.json'), 'utf-8')); 10 11// Annotate nodes with children count 12const annotatedNodes = nodes.map((n) => ({ 13 childrenCount: n.childrenPointers?.length ?? 0, 14 pointer: n.pointer, 15})); 16 17// Sort by childrenCount descending 18annotatedNodes.sort((a, b) => b.childrenCount - a.childrenCount); 19 20// Print top 20 hotspots 21console.log('Top 20 potential bottleneck nodes:\n'); 22annotatedNodes.slice(0, 20).forEach((n) => { 23 console.log(`${n.pointer} — children: ${n.childrenCount}`); 24});