Technology Blog

Look deep into latest news and innovations happening in the Tech industry with our highly informational blog.

3 easy ways to boost up the performance of your web application


When building a web application, there’s something you absolutely need to take account: performance. Your app may be greatly designed or have some killer features, nobody will use it if it’s not performant. Here are some important aspects which will make an app more performant.


Optimize your images

This is the most easiest thing and one of the most common mistakes you can find out there. When integrating images on an app, you’ve been told to use the pictures with the highest resolution to have the best quality images. That’s great. What you haven’t been told is that the images you use from Unsplash or Pexels often have huge dimensions and are not meant to be displayed on smaller screens.

It’s like watching a 10GB 4K movie on an old tiny computer. 4K or not, you won’t see many differences. That’s the same for images on a website. Thus, you must reduce the quality and resize the images in order to make them smaller.

There are plenty of apps that allows you to do so like For example, you can find below an example of an image whose size was reduced on squoosh:

pic courtesy :

Sure the image on the right is a little bit blurry and less detailed than the one of the left but at this zoom level, it’s still looking good to me and it’s also 96% smaller which means your browser loads 5.2MB less.

Code Splitting

If you’re building single-page applications (SPA) with client-side rendering (as with create-react-app or Vue CLI for example), this tip will also boost your app with little efforts.

In fact, client-side rendering means you are basically fetching on the server a bare bons HTML document with a JavaScript file (called a bundle) containing your whole application logic. This approach makes your app longer to load initially but more rich in terms of interaction and route changes. It’s a problem since a long initial load will be perceived badly by your users.

In fact, you will ship to the client this big JavaScript file even if your users don’t need to use every features of the application (typically a settings page when you can change your name or modify your password).

To solve this problem, you can use code splitting: “lazy-load” just the things that are currently needed by the user.

One common strategy is to split your code based on your different routes. Let’s take the example of a fake store app:

import { BrowserRouter as Router, Route, Switch } from "react-router-dom"
import React, { Suspense, lazy } from "react"
const Products = lazy(() => import("./Products"))
const Cart = lazy(() => import("./Cart"))
const Settings = lazy(() => import("./Settings"))
const App = () => (
    <Suspense fallback={<div>Loading...</div>}>
        <Route exact path="/" component={Products} />
        <Route path="/cart" component={Cart} />
        <Route path="/settings" component={Settings} />

With that approach, if the users want to browse your products, they won’t need to load the code associated to the Cart or the Settings page.

It can make your initial load way faster by saving hundreds and hundreds of KB, especially if your other pages use heavy third party libraries, which bring us to the third and last point.

Reduce the bundle size

We saw how to reduce the bundle size at the initial load. Here we will see how to reduce it but globally this time.

A great tool to do so is webpack-bundle-analyzer or source-map-explorer for Create React App users. We’ll show you an example with CRA here. There are few steps to follow:

  • Install source-map-explorer:
npm install --save source-map-explorer
  • Add an analyze script to your package.json file:
  "scripts": {
    "analyze": "source-map-explorer 'build/static/js/*.js'"

This will run source-map-explorer on the JS files generated by npm run build.

npm run build
npm run analyze

By running the script on one of your projects, you should get something similar to that:

pic courtesy :

You can see in the results that the bigger a dependency is, the more it takes up place visually. That’s a great way to spot the heaviest dependencies.

We ran source-map-explorer on a small project so you can see the bundle is not that big in our case. You’ll likely get a heavier bundle and more dependencies on bigger projects.

Then, get rid of heavy dependencies

Once you have the results, it’s up to you to see which dependencies are the heaviest and decide if you must find alternatives for them. To find the cost of a package in your bundle, We recommend bundlephobia. It’s great for comparing packages cost and making you wonder if you really need to install that dependency.

For example, we used to use moment.js for date manipulation. But it has a pretty big cost on your package:

pic courtesy :

In fact, moment is not modular. If you need to manipulate dates, then you need to create a Moment instance that gives you access to a lot of methods even if you use just one or two of them.

Now, We use date-fns which is way more modular and lighter too:

pic courtesy :

You can follow the same logic for a lot of dependencies. However, be pragmatic when making these choices:

  • If you use a package that seems to be both useless and heavy, it may be a good idea to get rid of it.
  • If it’s useful and heavy, then you can start searching for lighter alternatives.

these three tips gave you the will to optimize your apps (and create more stellar experiences for your users!). Of course, there are plenty of other performance tips like:

  • Avoiding unnecessary re-renders if you use React or Vue or something similar
  • Removing unused CSS with purgecss
  • Making use of caching
  • Using CDNs
  • Choosing the right type of databases and optimizing them
  • Reducing HTTP requests
  • Prefetching assets

We highly encourage you to explore all these options and see what they can bring to you performance-wise. However, don’t be obsessed with that. When it comes to building apps, there are always trade-offs.

For more information and to develop web application using Front-End technology, Hire Front-End Developer from us as we give you a high-quality product by utilizing all the latest tools and advanced technology. E-mail us any clock at – or Skype us: “hkinfosoft”. To develop any custom web apps using Js, please visit our technology page.

Content Source: