CodePark/ questions / Long tasks & the main thread
START PRACTICINGPRACTICE
Frontend question · Browser & web performance › Long tasks & the main thread

Your field data shows a bad INP. Which browser API can tell you which script caused the slow frames, including its source URL?

The Long Animation Frames API (long-animation-frame entries)

Long Animation Frames (LoAF) entries report any frame delayed by more than 50 ms. Each entry has a scripts list showing the script's sourceURL, the function that started it, and how long it ran. That points you to the guilty code.

"The Long Tasks API" is the tempting wrong answer. It reports that a long task happened, but it gives almost no detail about which script ran. Resource Timing and Navigation Timing measure downloads and page load, not main-thread work.