Summary
Tasks > 50ms block input — PerformanceObserver longtask attributes blame to scripts/iframe. Break work, move to worker, use idle callbacks. Long tasks during interaction window hurt INP directly. Main thread is zero-sum at scale.
Code example
new PerformanceObserver((list) => {
for (const entry of list.getEntries()) {
console.warn('Long task', entry.duration, 'ms', entry.attribution);
}
}).observe({ type: 'longtask', buffered: true });
Key points
- Tasks > 50ms block input — PerformanceObserver
longtaskattributes blame to scripts/iframe. - Break work, move to worker, use idle callbacks.
- Long tasks during interaction window hurt INP directly.
- Main thread is zero-sum at scale.