Measure before optimising
Baseline- Separate time to first byte, which is a server and network problem, from the time to render, which is a front-end problem. Optimising the wrong one is the most common wasted effort in this area.
- Use the metrics that describe what a user experiences rather than a single load number: when the main content becomes visible, when the page becomes responsive to input, and how much the layout moves while loading.
- Distinguish laboratory measurements from real user data. A test from a fast connection on a developer machine systematically hides the problems that most users have, and real-world data is usually the reason a page that 'tests fine' still feels slow.
Common trap: Jumping straight to a fix. If the page takes two seconds to return the first byte, minifying JavaScript changes nothing, and the interviewer will usually have engineered the scenario so that this is true.