7

Asynchronous Programming Performance Patterns

A key strength of JavaScript runtimes is the event loop, which couples “non-blocking input/output” within a single-threaded execution model. This means JavaScript is great for high-concurrency systems as long as they are not compute-bound systems (i.e., they’re IO-bound).

With the asynchronous and non-blocking IO, JavaScript has strong built-ins to orchestrate requests. In this chapter, we’ll cover the following topics:

  • Sequential and parallel asynchronous operation patterns in JavaScript, both with Promises only and with async/await
  • The cancellation and timeout of fetch requests with AbortController
  • Advanced asynchronous operation patterns: throttling, debouncing, and batching

At the end of ...

Get JavaScript Design Patterns now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.