Dmitri Pavlutin 12/29/2020

Why Promises Are Faster Than setTimeout()?

Read Original

This technical article investigates why Promise.resolve().then() executes faster than setTimeout(callback, 0) in JavaScript. It details an experiment, then explains the underlying cause using the event loop model, focusing on the priority of the microtask (job) queue over the macrotask (task) queue.

Why Promises Are Faster Than setTimeout()?

Comments

No comments yet

Be the first to share your thoughts!

Browser Extension

Get instant access to AllDevBlogs from your browser

Top of the Week