The Event Loop
summary
Demonstrates that async is not free: a synchronous factorials.map blocks an HTTP server though it finishes in ~100ms; switching each item to setImmediate makes the server responsive but triples total execution time (>3×). Introducing a batching helper reduces blocking to ~22ms while keeping total time near the original. Shows inconsistent “maybe async” file caching returns “done” before load until the second path is wrapped in process.nextTick, warns process.nextTick before I/O can starve IO, and explains libuv threadpool behavior.
AI-written summary · about
chapters (7)
- 0:00The problem with blocking
- 1:15Async performance pitfalls
- 3:12Batching for balance
- 4:46Consistent asynchronous behavior
- 7:14NextTick vs Immediate
- 8:20Understanding libuv
- 12:58Live demo and conclusion








