Interaction to Next Paint (INP) is a Core Web Vital that measures page responsiveness. A high INP score means the browser takes too long to render a visual update after a user click. Brutalist web applications, with their thick borders and interactive buttons, must be optimized to keep INP under 200ms.
How to Audit INP
Use Chrome Developer Tools to record page interactions. Look for Long Tasks (tasks blocking the main thread for over 50ms) during event handlers:
// Avoid blocking calculations inside event handlers
button.addEventListener("click", () => {
// Bad: Blocks thread
runHeavyCalculation();
updateUI();
});
Optimizing Event Handlers: Yielding to Main Thread
To prevent INP lag, yield main thread tasks to the browser using requestAnimationFrame or setTimeout to prioritize layout rendering:
button.addEventListener("click", () => {
// Good: Update UI immediately, defer calculation
updateUI();
// Defer heavy process using queueTask
scheduler.postTask(() => {
runHeavyCalculation();
}, { priority: "background" });
});
This ensures that the button changes its state instantly, maintaining visual feedback.
Web Vitals INP Benchmarks
| Metric | Ideal (Good) | Needs Improvement | Poor |
|---|---|---|---|
| INP Duration | < 200ms | 200ms - 500ms | > 500ms |
| First Input Delay | < 100ms | 100ms - 300ms | > 300ms |
| Cumulative Layout Shift | < 0.1 | 0.1 - 0.25 | > 0.25 |
Optimizing web vitals keeps user engagement high. For comparison on static page load speeds, read Next.js Static vs Dynamic Exports.
References & Citations
- Web Vitals INP Guidelines: Web Dev Official INP Docs
- JavaScript Event Loops: Mozilla Developer Network
- Design psychology in developer tools: Brutalist Web Design