UI Performance Enhancements

rebba saikiran
Dec 5, 2020 · 5 min read

I would like to begin with citing my mentors & team-mates who helped me to understand the concepts & enhance my knowledge on performance improvements of Website. It was a collaborative effort across teams from the planning stage till taking things to Production. The list of people whom I would want to thank is quite long but would want to cite a few notable people who had a larger influence in making this happen:

Let me give a brief Heads-Up:

UI Rendering was slow on Search Listing pages in our site as we had multiple cross-cutting components being loaded during the rendering of the page. There were also these redundant & sub-optimal recursive implementations which eventually built up over a period of time.

The listing page though owned by one part of the team; it had several modules that were managed by different teams.

The framework and the supporting tools we use are as below:

Diving into the waters right away …. how we swam through

Some of the BIG things we identified to be addressed immediately were as below:

  • Changing Image format from JPEG to WEBP

Until recently we were using JPEG format while rendering images on site. JPEG are heavier and for some odd reason we had been reliant on using jpg though WebP which is a far more improved version of image formatting techniques which supports both lossy & lossless compression was published 10 years ago.

WebP is an image formatting technique which uses both lossy and lossless compression. For more details you can refer to : https://developers.google.com/speed/webp/faq

As on the day of this writing, neither Firefox nor Safari had native support for WebP. This wasn’t a big deal for us to handle, because in Safari and FireFox users will still be rendered with JPEG version of the images. But the major chunk of users we have are luckily on Chrome or Edge. So, we had the support of Users intuitively.

  • Create Webpack chunk names

Webpack as the name suggests bundles modules of the project by building a dependency graph. This allows you to split your code into various bundles which can then be loaded on demand or in parallel. It can be used to achieve smaller bundles and control resource load prioritization which, if used correctly, can have a major impact on load time.

But for these bundles we give name to identify which bundle comprises of which components and node modules. So, by this we can identify the unnecessary modules loaded in that bundle and remove that.

You can use ‘npm run build –report’ command to get details of the kind of bundling one has in their UI modules. An example report would be as depicted below:

  • Single page application constraints

If your web-application comprises of multiple modules handled across multiple teams and each render part of the single page application, it therefore requires Code review from time to time across teams to avoid any Internal URL redirections etc, that would break the principle functioning of SPA.

We had a scenario where the Search pages of our E-Commerce site (blibli.com) was redirected to different url paths based on different types of requirement like SEO, brand or merchant pages.

As search pages are rendered along with other components that are not purely under the purview of Search, the url redirections caused us to re-load the page instead of just refreshing the result portion of page. We identified these simple concerns in the tech-debt part of a sprint to improve performance of the site and fixed the point of concerns.

  • Lazy loading of components & Images

One needs to identify the parts of the site / app that can be loaded lazily. Meaning request for the resource only when the user demands to view those sections explicitly and not to load the entire page on the first interaction.

This way we can reduce the network bandwidth used, number of resources loaded in the site, number of calls to the site or static resources. All in all you can find lot of benefits from this behavioral change of site. One can find enough tech articles describing the implementation of such a pattern.

  • Code Refactoring

Let’s take an example of a tree-structure component of E-Commerce site as shown below:

As and when user chooses an option an api call is made to reflect the changes caused by this user action. An api call if it is not fast enough the end users would see the screen frozen for a moment before reflecting the changes (even the selection status of the option).

Below is an example where the api call + the data structure processing + sending out UI trackers + drawing the items on UI entirely took lot of time.

The solution we identified was as below:

  1. Not to manipulate the DOM
  2. Show the tick mark when user clicks in the check box
  3. Reduce recursions in tree-view component that are unnecessary usage of computed properties
  4. Call trackers only after successful execution of the call
  5. Have loaders if the api calls take longer time.

We observed the change in experience for users and thus engagement on these tree structured UI interactions too improved.

What we finally saw …

Our overall web-site performance improved and thus User engagement increased. As per the lighthouse reports we could see that improvements were justified and measurable through these actions.

Our site performance before the above upgrades:

And improved to this after the changes:

This is not to say that we are done with the performance improvements and we are at the pinnacle of it. Rather this is just a start and there are still major upgrades happening on the performance as I write this article. I will share once we see its light. Till then…Adios 👍

Blibli.com Tech Blog

Articles on Blibli.com's engineering, culture, and technology. Written and curated by the very people who build Blibli.com. The views expressed are those of the authors and don't necessarily reflect those of Blibli.com.

rebba saikiran

Written by

Blibli.com Tech Blog

Articles on Blibli.com's engineering, culture, and technology. Written and curated by the very people who build Blibli.com. The views expressed are those of the authors and don't necessarily reflect those of Blibli.com.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store