Web BuildingAdvanced

Web Performance Optimisation

Optimise web apps for speed - Core Web Vitals, lazy loading, caching, and bundle size reduction.

4 hours
5 key concepts
2 in-depth sections
Official Docs

0 of 5 concepts completed (0%)

What You'll Learn

1.Core Web Vitals

MetricGoodPoorMeasures
LCP (Largest Contentful Paint)≤ 2.5s> 4sLoading
INP (Interaction to Next Paint)≤ 200ms> 500msInteractivity
CLS (Cumulative Layout Shift)≤ 0.1> 0.25Visual Stability
    Improving LCP: ```html

Hero - Sufi Khan Sulaiman ```

Fixing CLS: ```html

.card { transform: translateY(-10px); } /* Good no layout shift */ .card { top: -10px; } /* Bad causes CLS */ ```

2.JavaScript & Image Optimization

javascript
// Code splitting at route level
const Dashboard = lazy(() => import("./pages/Dashboard"));
function App() {
  return (
    <Suspense fallback={<Skeleton />}>
      <Routes>
        <Route path="/dashboard" element={<Dashboard />} />
      </Routes>
    </Suspense>
  );

// Tree shaking import specifically import debounce from "lodash/debounce"; // Good import { debounce } from "lodash"; // Bad: bundles ALL of lodash

// Intersection Observer for lazy images const observer = new IntersectionObserver((entries) => { entries.forEach(entry => { if (entry.isIntersecting) { entry.target.src = entry.target.dataset.src; observer.unobserve(entry.target); } }); }, { rootMargin: "200px" }); ```

html
<!-- Modern formats: AVIF > WebP > JPEG -->
<picture>
  <source srcset="hero.avif" type="image/avif" />
  <source srcset="hero.webp" type="image/webp" />
  <img src="hero-sufi-khan-sulaiman.jpg" alt="Hero - Sufi Khan Sulaiman" width="1200" height="630"
       loading="lazy" decoding="async" />
</picture>

Code Example

// React lazy loading
import { lazy, Suspense } from "react";

const Dashboard = lazy(() => import("./pages/Dashboard"));

function App() {
  return (
    <Suspense fallback={<div>Loading...</div>}>
      <Dashboard />
    </Suspense>
  );
}

// Intersection Observer for lazy images
const observer = new IntersectionObserver((entries) => {
  entries.forEach(entry => {
    if (entry.isIntersecting) {
      const img = entry.target;
      img.src = img.dataset.src;
      observer.unobserve(img);
    }
  });
});

document.querySelectorAll("img[data-src]").forEach(img => {
  observer.observe(img);
});

Pro Tips

  • 1Measure before optimizing. Run Lighthouse first you'll find the 20% of changes that produce 80% of gains.
  • 2CLS is usually caused by images without explicit width/height or content inserted above existing content. Always specify image dimensions.
  • 3JavaScript is the most expensive resource not just to download but to parse and execute. Every KB removed is significant on mobile.
  • 4Use Chrome DevTools Coverage tab to find unused CSS and JavaScript. 40-70% of CSS on average pages is never used.

Topics Covered

PerformanceCore Web VitalsOptimisation

Continue Learning

Explore the official documentation and deepen your knowledge with real-world practice.

Explore the Full Portfolio

This is the complete portfolio of Sufi Khan Sulaiman, a technology leader specialising in B2B commerce and digital automation. Start from the Home page for the overview, then move through two decades of career experience across FLIR Systems, Lorex Technology, and 1c Platform, and the full catalogue of project case studies spanning headless commerce migrations, AI recommendation engines, and multi-channel fulfilment systems.

The skills and certifications page maps the technical and leadership capabilities behind the work, while the articles and the knowledge base break down the thinking into actionable frameworks. For hands-on learning, the tutorials and applications sections cover practical builds from front-end fundamentals to full-stack web apps.

For consulting engagement, the expertise page outlines service offerings, the ecommerce hub covers platform architecture and automation strategy, and the ecommerce guide (PDF) is a downloadable 55-page field manual. When you are ready to talk, the contact page is the direct line.