Zum Hauptinhalt springen
Echtzeit-Radar & Feeds
Alle RSS Feeds ➔
👥 Community & Social
••••••
Sichere ProgrammierungLast week in Agent Security 1: We are not-a-mused!(29.09.2026 um 02:15 Uhr)
••••••••••
Sichere ProgrammierungLast week in Agent Security 1: We are not-a-mused!(29.09.2026 um 02:15 Uhr)
••••
Intelligence View
⚡ tsecurity.de Intelligence

Macro tasks, Micro tasks and Long tasks - Web dev

Tasks: The Essential Components of All Browser Activity Imagine a web browser as a tireless worker, ceaselessly performing a myriad of tasks to ensure your browsing experience is seamless. Every little thing it does, from parsing HTML…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

Tasks: The Essential Components of All Browser Activity



Imagine a web browser as a tireless worker, ceaselessly performing a myriad of tasks to ensure your browsing experience is seamless. Every little thing it does, from parsing HTML code to running your JavaScript, is considered a task. These tasks can be initiated by various events, such as user interactions, network requests, or even internal operations within the browser itself.



Browser task



The Main Thread: The Orchestra's Busy Maestro



The browser possesses a single main thread that is responsible for handling all these tasks. You can think of it as the maestro of an orchestra, coordinating every section to create a harmonious performance. However, there's a catch: the main thread is only capable of executing one task at a time. This means that any task that takes a long time to complete can block the main thread, leading to a delay in other tasks and making your website feel unresponsive and sluggish.



Browser main thread



The Event Loop: The Master Choreographer of Tasks



So, how does the browser keep everything from coming to a standstill when there's a long-running task? The answer lies in the Event Loop. This ingeniously designed mechanism continuously checks for tasks in a queue and executes them one after the other on the main thread. Whenever a new task comes in, it is added to the queue, ensuring that every task is executed in an orderly manner.



Macrotasks vs. Microtasks: A Matter of Task Hierarchy



However, it's important to note that not all tasks are created equal. We have two primary categories of tasks: Macrotasks and Microtasks. Macrotasks include typical JavaScript code, network requests, and DOM manipulations. Microtasks, on the other hand, consist of smaller tasks like resolving promises or handling async/await.



The key difference between the two lies in their execution order: whenever a macrotask finishes, the Event Loop processes any pending microtasks before it moves on to the next macrotask. This hierarchical structure ensures that the browser remains responsive, allowing it to handle user interactions even in the middle of long-running macrotasks.



Micro tasks and macro tasks



The Nemesis of Smooth Scrolling: Long Tasks



While the Event Loop does a commendable job of managing tasks, any task that takes too long to complete (generally anything above 50ms) becomes a long task. A long task can block the main thread, leading to stuttering animations, delayed input responsiveness, and an overall frustrating user experience.



Detecting Long Tasks: Unmasking the Culprit



Fortunately, modern developer tools like Chrome DevTools come to our aid. The Performance tab in these tools enables you to identify long tasks, pinpointing the specific code that is causing the bottleneck and allowing you to optimize your website for a smoother user experience.



Chrome long task

2. Cyber Threat Intelligence & Forensik

CTI Threat Relationship Graph2 Knoten / 1 Relationen
CVE / Incident Software MITRE ATT&CK CWE Weakness IoC
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Macro tasks, Micro tasks and Long tasks - Web dev

Thematisch verwandte Begriffe: Macro, tasks, Micro, Long · 6 Treffer

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

💬 Kommentare werden geladen…
Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-101916 | @grpc/grpc-js implements the core functionality of gRPC purely in JavaS…
Advisory →
tsecurity.de Icon
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag