A fast website starts with less code
Performance is rarely won by optimising: it is won by removing. The useful question is not “how do I load this script faster?” but “why does this page need a script at all?”.
RGAIX team · · 6 min read
Tell a page from an application
A service page, an article, a case study are documents: they display content and links. A checkout, a dashboard, a configurator are applications: they hold state and react.
Treating them the same way means shipping a complete interface engine to display three paragraphs. The visitor downloads, parses and runs code they will never make use of.
What an unnecessary interactive component costs
| Element | Document version | Application version |
|---|---|---|
| Dropdown menu | Native element, zero JavaScript | Controlled component, state, listeners |
| Frequently asked questions | Native disclosure elements | Animated accordion |
| Content tabs | Anchors and sections | Internal router and conditional rendering |
| Simple form | Browser validation | A full form library |
The left-hand column is not a step backwards: native elements are keyboard accessible, work without JavaScript and behave correctly with screen readers, which takes considerable work to reproduce.
Give the server back what belongs to it
Content that does not change from one visitor to the next has no reason to be assembled in the browser. Producing it at build time or on the server removes, in one move, the parsing time, the execution time and the dependency on the network.
Limit the number of decisions at load time
Every conditional check at load time — theme, language, consent, A/B test, personalisation — adds a step before the first useful render. Three of those mechanisms are enough to turn a light page into a slow one.
- Decide the language from the URL rather than from a detection script.
- Serve the default theme immediately, adjust afterwards.
- Reserve the space for the consent banner instead of pushing the content.
- Load third parties after the first render, never before.
Measure what you remove
Every removal must be checked like an addition: journeys tested, keyboard behaviour, rendering on an older phone. Removing code is a change like any other, and regressions are just as possible.
The fastest code is the code you do not send. The second fastest is the code the browser already knows how to run without being taught.
Related pages
Web & mobile development
Software that serves your business.
Discover the service ↗READ NEXTURL migration: the redirect plan that avoids the collapse
Changing addresses is a routine and brutal operation. What makes it safe fits in four rules and one mapping file.
Read the article ↗READ NEXTTaking over an existing project: the ten entry checks
Before writing the first line, ten checks say whether the takeover is feasible, expensive, or impossible as things stand.
Read the article ↗Let’s talk about what is blocking you.
An emergency, a profile to find or a project to structure: let’s start with your need.
