Performance

Measure Where the Time Goes Before You Optimise Anything

Perceived speed is four hops: browser, server, database, cold start. Optimising the wrong one is free-looking work.

1 min readPublished May 26, 2026
Share on X

A page feels slow. An engineer immediately assumes the JavaScript bundle is too heavy, spends three days converting components to dynamic imports, reduces the bundle by 40kB, and deploys. The page is still slow.

Because the latency was never in the bundle. The latency was an unindexed database query taking 900ms before returning the initial HTML.

The four hops of web latency

Every request traverses four distinct boundaries, and each has its own order of magnitude:

  • DNS & TLS: connecting to the server (50ms - 200ms).
  • Time to First Byte (TTFB): the server computing the response (50ms - 2000ms).
  • Network transit: downloading the bytes (10ms - 500ms).
  • Browser parsing & rendering: evaluating JavaScript and painting the DOM (50ms - 1500ms).
Total load: 2,400ms
  - TTFB (backend query):      1,850ms (77%)
  - Download CSS/JS:             150ms  (6%)
  - React hydration:             400ms (17%)

Optimising React hydration addresses at most 17% of the latency.

Optimising without profiling is just moving code around until you get tired.

The profiling protocol

Before opening a component file, run a single request through WebPageTest or Chrome DevTools Network tab with CPU throttling disabled. Look at the water fall: if the white bar (waiting for server) dwarfs the blue bar (content download), your frontend is fast and your backend is broken. Fix the bottleneck that actually owns the time.

  • Performance
  • Observability
  • Backend
KI

Kadirul IslamVerified author

Founder, A.K Solution

Follow on X

Founder of A.K Solution. Full-stack engineer building AI agent tools like KiCode, JSON form engines like ki-forms, and high-scale SEO systems. Obsessed with shipping fast, zero-bloat software that lasts.

More from Kadirul Islam

A Slow App Is Often Just a Database Waking Up

Free tiers suspend on idle. The first request after a pause pays a cold start, and it looks exactly like a slow product.

2 min readPerformance

The Index You Meant to Create

I wrote the migration, the model was correct, and the production database never saw it. Full-table scans for weeks.

1 min readDatabases