// DevTools Console + Performance API 的最小诊断片段。 console.group('page diagnostics'); console.table(performance.getEntriesByType('navigation').map(entry => ({ type: entry.type, domContentLoaded: Math.round(entry.domContentLoadedEventEnd), load: Math.round(entry.loadEventEnd), }))); console.groupEnd(); new PerformanceObserver(list => { for (const entry of list.getEntries()) { console.log('long task', Math.round(entry.duration), 'ms', entry.name); } }).observe({ type: 'longtask', buffered: true });