Book a free call

How to Make Your Web App Faster: Practical Speed Tips

A slow web app loses users before they see your product. The speed fixes that matter most: smaller bundles, caching, images, database queries and rendering.

Hertiv engineering teamReviewed by a senior engineer
5 min read
How to Make Your Web App Faster: Practical Speed Tips
On this page

Short answer

A web app gets faster when the browser downloads less, waits less and renders less. The fixes that matter most are smaller JavaScript bundles, caching for repeat visits, compressed images, faster database queries and rendering only what the screen needs. Measure first with a real page load, fix the biggest delay, then measure again; guessing usually points at the wrong bottleneck.

What makes a web app slow?

A web app is slow when the browser waits too long for files, the server takes too long to answer, or the page does too much work before it can be used. Most slow apps suffer from all three at once, but one of them is usually the biggest delay.

Large JavaScript bundles are the most common cause. A page that ships several megabytes of code must download, parse and run it all before the user can click anything. Uncompressed images, chat widgets and tracking scripts add weight on top.

Slow database queries are the second cause. A page that runs ten queries, one after another, waits for each in turn. Caching, the third cause, is often missing entirely, so every visit repeats work that could have been reused.

Which speed fixes help most?

The speed fixes that help most are the ones that remove work: smaller bundles, caching, fewer requests and faster queries. Start with the fix that matches your biggest delay, not the one that is easiest to describe.

FixWhat it changesEffort
Code splittingLoads only the code each page needsMedium
CachingReuses files and dataLow
Image compressionSmaller downloadsLow
Database indexesFaster queriesMedium
Lazy loadingDefers off-screen contentLow
Server renderingFaster first paintMedium

Measure before you change anything. A simple timing of a real page load shows whether the delay is in the download, the server or the rendering, and each delay has a different fix. Monitoring tools help here; see the best application performance monitoring software list.

How do you shrink what the browser downloads?

You shrink what the browser downloads by splitting code, removing what is unused, and compressing what is left. Most apps ship code that the current page never runs.

Code splitting loads only the code for the page the user opened, and loads the rest when it is needed. Tree shaking removes functions and libraries that are imported but never called. Both are built into modern bundlers and need configuration, not new code.

Compression comes next. Text files such as JavaScript and CSS compress well, and modern compression can cut their size by more than half. Images need a different approach: modern formats, sensible dimensions and compression tuned to the content. Removing unused CSS and JavaScript has the same effect as splitting code: every kilobyte you delete is a kilobyte the browser never downloads, parses or runs.

How does caching speed up a web app?

Caching speeds up a web app by storing files and data so they do not have to be fetched again. A returning visitor loads the app from the local cache instead of the network, and the server answers repeated questions from memory instead of the database.

Browser caching stores static files such as scripts, styles and images with a versioned name, so the browser keeps them until the version changes. A content delivery network puts those files on servers close to the user, which cuts the travel time.

Server caching stores the answers to common queries and rendered pages. The rule is simple: cache what rarely changes, keep the cache short for what changes often, and always have a way to clear it when the data changes.

How do images and fonts slow a page down?

Images and fonts slow a page down because they are often the largest files on it, and they are loaded even when they are not yet visible. A hero image saved at full camera resolution can weigh more than the rest of the page combined.

Resize images to the size they are shown at, use modern formats, and compress them. Load images below the fold only when the user scrolls near them, and give each image its width and height so the page does not jump when it arrives.

Fonts need the same care. Each weight and style is a separate download, so use only the weights the design needs, and let the browser show fallback text while the font loads instead of a blank page.

How do slow database queries hurt speed?

Slow database queries hurt speed because the server cannot answer until the database does, and the user waits for the whole chain. A page that runs many queries in sequence multiplies the delay.

The usual fixes are indexes on the columns used in filters and joins, fetching only the fields the page shows, and combining many small queries into fewer larger ones. A query that scans a whole table for a handful of rows is the first thing to fix.

Connection pooling also helps: opening a new database connection for every request adds a delay that pooling removes. And when the same data is requested often, caching the answer is cheaper than asking the database again. Watch out for the N+1 pattern too: a list page that runs one extra query per row will slow down as the list grows, so fetch related rows in one query instead.

Example (hypothetical): an online shop cuts its load time

Example (hypothetical): an online shop's product page loads in 4.2 seconds and makes 120 requests. The team measures first and finds the bundle is 2.4 megabytes, the images are uncompressed, and the page runs 14 database queries.

They split the bundle, which cuts it from 2.4 megabytes to 0.9 megabytes. They compress the images, which cuts image weight from 1.8 megabytes to 0.6 megabytes. They add indexes and combine queries, which cuts the count from 14 to 5.

The arithmetic adds up. Total page weight falls from 4.2 megabytes to 1.5 megabytes, and requests fall from 120 to 58. Load time falls from 4.2 seconds to 1.6 seconds. No single fix did the job; the bundle, the images and the queries each contributed about a third of the gain.

What are the common mistakes?

The most common web speed mistakes are optimising without measuring, chasing a '10x faster' promise, and adding speed tools on top of a bloated page.

  • No measurement. Changing code without a before-and-after timing means you cannot tell what helped.
  • Believing '10x' claims. No single tip makes a typical app ten times faster; real gains come from several fixes together.
  • Too many scripts. Chat widgets, trackers and pop-ups each add weight and delay; audit them regularly.
  • Caching everything. Caching data that changes often serves stale answers; cache lifetimes must match the data.
  • Ignoring mobile. A page that is fast on office wifi can be slow on a phone network; test on a real device.

Key takeaways

  • Most slow web apps suffer from large bundles, slow queries and missing caching at once
  • Measure a real page load first; each delay has a different fix
  • Code splitting, compression and caching remove work instead of adding it
  • Images and fonts are often the largest files, so resize, compress and defer them
  • No single tip makes an app ten times faster; real gains come from several fixes together

Frequently asked questions

What is the fastest way to speed up a web app?

Measure first, then fix the biggest delay. For most apps that means splitting the JavaScript bundle, compressing images and adding caching. One fix rarely does the job; the usual result comes from three or four small changes together.

Does caching make a web app faster?

Yes, for repeat visits and repeated questions. Browser caching stores static files locally, a content delivery network puts files near the user, and server caching answers common queries from memory instead of the database.

How do images affect web app speed?

Images are often the largest files on a page. Resize them to the size shown, use modern formats, compress them, and load below-the-fold images only when the user scrolls near them.

What is code splitting?

Code splitting loads only the JavaScript the current page needs and loads the rest when it is needed. It is built into modern bundlers and is one of the biggest single wins for apps that ship one large bundle.

Why is my web app slow on mobile but fast on desktop?

Mobile networks are slower and less stable, and phones have less processing power. A page that is fast on office wifi can be slow on a phone network, so test load time on a real device with a mobile connection.

Should I use a content delivery network?

A content delivery network helps when users are far from your server, because it serves static files from a nearby location. It is worth it for apps with users in several regions, and less useful for an app used only in one city.

Found this useful? Share it.
Hertiv engineering team

Written from projects we build for clients: software products in production. Every post is reviewed by a senior engineer before publishing and updated when practice changes.

About HertivHow we work

Is your web app slower than it should be? Talk to Hertiv.

A senior engineer replies within one business day. Or see our Web App Development service.

Book a free call

Keep reading

All posts

Tell us what you want to build

A senior engineer reads every request and replies within one business day with questions, a rough range, or a call link.

  • NDA on request before any details
  • You own all code, models and IP
  • US, UK and EU time-zone overlap

Your email app should open with your message ready to send. If it does not, write to contact@hertiv.com.

Prefer email? Write to contact@hertiv.com
Estimate costBook a call