A Field Guide to streaming — Performance article on streaming

A Field Guide to streaming

Patterns, anti-patterns, and the questions to ask before you commit to a direction. Every example runs in the browser with no build step.

Everything here assumes a single document and a single user. Both assumptions break eventually, and the resulting failures are interesting because they are the same shape as the original problem, only larger.

Start with the smallest thing that could possibly work. Not because it is the final answer, but because it gives you something to measure against, and measuring is how you find out whether the clever version is worth it.

The thing nobody tells you about streaming is that the specification is short and the implementation history is not. Every behaviour you rely on was added for a reason that no longer applies to your code.

We used a feature query, a polyfill, and a fallback that shipped the old behaviour. It is unglamorous and it works, and it has survived three major browser releases without incident.

Performance work is mostly the discipline of removing work. The hard part is not the profile — it is convincing everyone that the problem is worth solving before you have solved it.