3.3Performance & cache
The essentials in 30 seconds
- Cache serves a pre-generated version of pages instead of rebuilding them on every visit: the number-one speed lever.
- Combine cache + optimised images + lazy loading; CSS/JS minification and a CDN complete the picture as needed.
- Don't guess: measure with PageSpeed Insights or GTmetrix before and after each optimisation.
Running mini-case — eight seconds is too long
The workshop site takes eight seconds to display: the photos are heavy and every page is rebuilt on every visit. Samir measures the starting point, installs a cache suited to the hosting, enables minification and checks that nothing breaks. He measures again and presents the gain to Hassan with figures.
Sequel to case 3.2 — the site is visible; it must also be fast.
1. Cache, the number-one lever
Without caching, WordPress rebuilds every page on every visit: PHP queries the database, assembles the HTML, then sends it. Cache keeps an already-generated version and serves it almost instantly. This is often the most spectacular gain for a brochure site or a blog.
The choice of plugin depends on the hosting: LiteSpeed Cache if the server is LiteSpeed, WP Super Cache or W3 Total Cache for free options, WP Rocket as a paid option for simplicity. Samir enables only one cache plugin and clears the cache after every major change.
2. Completing and measuring
Caching is not enough if images weigh several megabytes. Combine it with image optimisation (section 1.3) and lazy loading. Minification removes spaces and comments from CSS/JS; a CDN brings files closer to visitors, especially for an international audience. Every option must be tested: aggressive minification can break a layout.
Samir measures with PageSpeed Insights or GTmetrix before and after. He notes the scores, load time and recommendations, then fixes one thing at a time. In performance, proof is numerical: it is also what reassures the client.
🔎 Concrete example — Speeding up the workshop (Samir's case)
Before: 8.2 s, PageSpeed score 38.
1. Images resized and compressed.
2. LiteSpeed Cache enabled (page cache + lazy loading).
3. CSS/JS minification tested on one page.
After: 2.1 s, score 82.
→ Check the cart and forms after enabling.
Result: a measured gain that can be presented to the client.
Lesson: one optimisation at a time, then measure.
Section vocabulary
- Cache
- A pre-generated version of pages, served instead of being rebuilt on every visit.
Simple example: the Collections page loads almost instantly.
What it is not: letting WordPress rebuild every page on every visit.
Reflex: cache = speed lever no. 1.
- Cache plugin
- A module that generates and serves the cache: LiteSpeed, WP Super Cache, WP Rocket.
Simple example: only one plugin active at a time.
What it is not: stacking three cache plugins.
Reflex: one plugin, properly configured.
- Minification
- Removing spaces and comments from CSS/JS to reduce file size.
Simple example: enable minification, then test the rendering.
What it is not: minifying without checking that the page works.
Reflex: test after minification.
- CDN
- A network of servers that brings files closer to the visitor.
Simple example: Cloudflare for an audience outside Morocco.
What it is not: paying for a CDN with no international audience.
Reflex: CDN = useful depending on the audience.
- Measurement (PageSpeed)
- Tools that score speed and list issues to fix.
Simple example: PageSpeed Insights before/after.
What it is not: judging speed by feel.
Reflex: figures before/after.
In practice — Speeding up the site and proving it
- Measure a page in PageSpeed Insights and note the score.
- Install a single cache plugin suited to the hosting and enable page caching.
- Enable the useful options (lazy loading, minification) and check that the site works.
- Measure again and compare the scores and load time.
Ready-to-use script — presenting the gain (20 s)
“Before, your site took more than eight seconds to display. After optimisation, we are down to around two seconds: visitors stay, and Google values fast sites. I'll show you the measurements before and after.”
Always rely on measured figures, not on an impression.
Copy-paste template — performance sheet
PAGE MEASURED: _______________
SCORE BEFORE: _______________ / TIME: _______________
CACHE ENABLED: yes / no (plugin: _______________)
IMAGES OPTIMISED: yes / no / LAZY LOADING: yes / no
SCORE AFTER: _______________ / TIME: _______________
ANOMALIES CHECKED: cart / forms / menu
LiteSpeed hosting
LiteSpeed Cache includes cache, minification and lazy loading.
Standard shared hosting
WP Super Cache is enough for a brochure site; measure after configuring.
Shop
Exclude the cart and account from the cache, test the checkout.
International audience
Add a CDN and check performance from several regions.
✓ Best practices
- Measure before and after every change.
- One cache plugin only.
- Test the cart and forms after optimisation.
✗ Common pitfalls
- Stacking several cache plugins.
- Minifying without checking the rendering.
- Optimising by feel without measuring.
Key takeaways
- Cache is the number-one speed lever.
- Cache + images + lazy loading form the performance trio.
- One cache plugin, properly configured.
- Measure with PageSpeed before and after.
48h Challenge — apply tomorrow
Measure a page, enable the cache and optimise the images, then measure again. Note the two scores and the time gained. 20 minutes.
- I measure speed before optimising.
- I enable a suitable cache with no duplicates.
- I check that the optimisations break nothing.
Frequently asked questions
Is caching useful on a small site?
Yes: even a low-traffic brochure site gains a clear response-time improvement, and caching reduces server load. It is one of the most cost-effective optimisations.
Why clear the cache after a change?
Because the cache serves an old version of the page. After a change to content, design or a plugin, clear the cache so the new version is visible and served.
Is a CDN essential?
No. It becomes worthwhile when the audience is far from the server or traffic is high. For a local audience, good hosting and a well-configured cache are often enough.
The workshop site takes eight seconds to display. What is the most cost-effective lever?