Comparison
Long taskvsThird-party script
Long task
one function held the main thread for 300 milliseconds and every click during it queued up behind it.
Any task occupying the main thread for more than fifty milliseconds, during which the browser cannot respond to input or paint. It is the atomic unit of unresponsiveness: interaction latency is almost always a queue behind one of these. Breaking one up means yielding to the event loop between chunks, which is what `scheduler.yield` and the older `setTimeout` trick both do.
Full entry →Third-party script
the page got half a second slower and nobody on the team changed any code that week.
A script loaded from another origin and controlled by someone else: analytics, tag managers, chat widgets, ads. It runs with full access to your page, competes for the main thread and the network, and can change without warning or review. It is very often the largest single item in a performance investigation, and the one nobody has the authority to remove.
Full entry →