Development

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

Business application connecting users, software components, APIs and data
DevelopmentA fast website starts with less code

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

ElementDocument versionApplication version
Dropdown menuNative element, zero JavaScriptControlled component, state, listeners
Frequently asked questionsNative disclosure elementsAnimated accordion
Content tabsAnchors and sectionsInternal router and conditional rendering
Simple formBrowser validationA 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.

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.

Talk to RGAIX