How to Boost Web Performance by 94%: A Modern Approach to Speed, Caching, and Optimisation

Shivam JhaShivam Jha
5 min read

Table of contents


Transforming Web Performance: Achieving a 94% Response Time Improvement Through Modern Optimisation Techniques

In the fast-evolving landscape of web development, performance remains a critical pillar for delivering exceptional user experiences. Users today expect pages to load instantly, and slow performance can directly impact engagement, conversions, and search rankings. This article walks through a comprehensive approach to modern web performance optimisation that achieved a remarkable 94% improvement in server response times and transformed an existing web platform into a lightning-fast, scalable application.

Identifying the Performance Bottlenecks

The journey begins with an honest assessment of existing limitations. The application initially relied on server-side rendering (SSR) for every user request, resulting in average server response times of around 850 milliseconds, which is far from ideal for today’s standards.

Additional challenges included:

  • Large JavaScript bundles causing long load and parse times.

  • Legacy JavaScript polyfills inflating bundle size unnecessarily for modern browsers.

  • Analytics and tracking scripts blocking the main thread during initial page load, hurting key Core Web Vitals metrics.

  • Inefficient caching and resource loading strategies.

Addressing these issues holistically was essential to achieving tangible performance gains.


Architectural Overview: How the Optimised Stack Works

Here’s an overview of the improved request flow and optimisation layers:

  • User Request → ISR Cache Check → Cached Response (10 – 50ms)

  • If not cached → API Call → In-Memory Cache → Serve Response

  • Bundles delivered as optimised chunks with minimal dead code

  • Modern browsers only: Legacy polyfills trimmed for most users

  • Analytics scripts deferred until after user interaction for better Core Web Vitals

This architecture delivers most user requests as ultra-fast cached pages, minimising server workload and speeding up the browsing experience.


Leveraging Incremental Static Regeneration (ISR) for Speed and Scalability

A cornerstone of the optimisation was moving from traditional SSR to Incremental Static Regeneration (ISR). ISR combines the best of static site generation and dynamic content updates by pre-building pages that are frequently requested and regenerating them incrementally after a configurable interval.

Key benefits included:

  • Response times dropped drastically from around 850ms to as low as 10 – 50ms for cached pages.

  • Over 95% cache hit rates ensured that most users experienced near-instant page loads.

  • Server load dropped by nearly 90%, enabling efficient resource utilisation during peak traffic.

This architectural shift greatly improved speed and scalability without sacrificing content freshness.


Enhancing API Performance with Intelligent In-Memory Caching

API responsiveness was significantly accelerated by implementing a lightweight in-memory cache with time-to-live (TTL) functionality:

  • Cache hits served data in under 2 milliseconds.

  • Cache misses triggered fresh API calls averaging around 50 milliseconds.

  • Overall server response time was reduced by 94% compared to the original setup.

  • Continuous monitoring of cache hit and miss rates ensured system health and efficiency.

This caching layer minimized redundant API calls while delivering fresh content seamlessly.

Reducing Bundles and Dead Code via Tree Shaking and Module Optimisation

Heavy JavaScript bundles were streamlined by strict tree shaking and module import optimisation:

  • Webpack’s tree shaking was fully enabled with unused exports removed.

  • Chunk splitting was carefully configured to separate vendor and common code.

  • Imports were shifted from common but bulky libraries (like lodash and moment) to their more modular, tree-shakeable counterparts (like lodash-es and date-fns).

  • Unnecessary React default imports were eliminated when only JSX syntax was used.

  • These efforts reduced bundle bloat by over 90%, improving load times and parsing performance significantly.


Targeting Modern Browsers to Slash Legacy Polyfills

Legacy polyfills for outdated browsers added approximately 18 KB to initial JavaScript payloads unnecessarily, since the majority of users were on modern browsers. By raising the baseline browser support to:

  • Chrome 90+

  • Firefox 88+

  • Safari 14+

  • Edge 90+

The Polyfill footprint was reduced by 10 – 15 KB, cutting down blocking time and improving script run performance on currently used devices.


Deferring Analytics Scripts to Boost Core Web Vitals

Scripts for analytics and tracking (such as Google Tag Manager, Facebook Pixel, and others) traditionally loaded immediately on page load, blocking the main thread and delaying visual rendering.

Using a user interaction detection hook, these scripts were deferred and only loaded after the first meaningful user interaction (e.g., click, scroll, or keypress):

  • Initial page render became much faster.

  • Largest Content-ful Paint (LCP) and First Content-ful Paint (FCP) metrics improved by over 80%.

  • Critical analytics functionality was preserved without compromising user experience.


Fine-Tuning Document Head and Next.js Configuration for Optimal Resource Delivery

Additional performance gains were realised by:

  • Adding resource hints such as pre-connect and dns-prefetch for critical external domains.

  • Preloading key images to prioritise their download early.

  • Inlining critical CSS to prevent render-blocking stylesheets delays.

  • Optimising Next.js chunk splitting to keep bundles under 200 KB, balancing caching efficiency with load speed.

  • Enabling experimental features such as ESM externals for modern JavaScript module delivery.

  • Implementing image delivery optimisations including WebP and AVIF format support.

Translating Technical Gains into Business Value

  • Dramatic speed improvements lead to lower bounce rates and longer sessions.

  • Reduced server load cuts infrastructure expenses and improves scalability.

  • Enhanced Core Web Vitals positively influence search engine rankings.

  • Deferred script loading maintains essential analytics without affecting perceived speed.

  • Cleaner, modular codebases improve developer experience and maintainability.


Let me break this down into a visual flow diagram.

The diagram uses colour coding to differentiate between:

  • Blue: Entry points and user interactions

  • Green: Fast cached responses and performance wins

  • Orange: User experience outcomes

  • Purple: Optimisation techniques

  • Yellow: Business benefits

Next Steps: Continuous Optimisation

The path forward includes plans to:

  • Introduce service workers for offline capabilities and smarter background sync.

  • Explore differential serving for separate modern and legacy bundles.

  • Enhance image loading with more aggressive lazy loading and responsive techniques.

  • Implement edge caching using Redis or CDNs for even faster data delivery.

Conclusion: Building for Speed Is Building for Success

Delivering exceptional web performance requires a multi-layered approach that balances architecture, caching, code optimisation, and user experience strategies. By adopting incremental static regeneration, smart API caching, rigorous bundle analysis, modern browser targeting, and user interaction-driven script loading, it’s possible to transform sluggish applications into blisteringly fast user experiences. For teams striving to deliver quality at scale, these principles offer a clear roadmap for sustainable performance excellence.

Ready to take your web performance to the next level? Start by measuring your bottlenecks, prioritise caching and static regeneration, and continuously refine your codebase for modern browsers. The payoff is faster loads, happier users, and stronger digital presence.

0
Subscribe to my newsletter

Read articles from Shivam Jha directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Shivam Jha
Shivam Jha