Engineering & Performance•9 min read

From 3 Seconds to Instant Load: How We Optimized ClearCut Studio and Cut 35 MB of Hidden Overhead

A technical yet accessible post-mortem on how we diagnosed 2-3 second load times on our landing page, discovered an accidental 6 MB favicon, dismantled a monolithic AI bundle, and turned ClearCut Studio into an ultra-fast web experience.

F
Fabian H.Founder & Lead Developer
From 3 Seconds to Instant Load: How We Optimized ClearCut Studio and Cut 35 MB of Hidden Overhead

From 3 Seconds to Instant Load: How We Optimized ClearCut Studio and Cut 35 MB of Hidden Overhead

At ClearCut Studio, our philosophy has always been radical: absolute privacy and 100% local processing right inside your browser. Instead of sending your personal photos to a remote cloud server, our software stack—from our local AI background remover to our WebAssembly image compressors—runs directly on your computer or smartphone.

However, we recently ran into a frustrating paradox: our landing page was taking between 2 and 3 seconds to open.

On the modern web, 3 seconds is an eternity. It is the boundary between an engaged user enjoying your product and an impatient visitor closing the tab. How could an application engineered for extreme speed and privacy have such a sluggish initial load?

We embarked on a forensic performance audit of every byte sent across the network. What we discovered was a fascinating cocktail of invisible oversized assets, monolithic imports, and an overzealous Service Worker.

In this article, we break down step-by-step—in plain English for developers and non-technical readers alike—what we found, how we fixed it, and the lessons anyone in tech can take away from this optimization journey.


1. The Anatomy of the Problem: Why was the page taking so long?

To understand what was happening, consider a simple analogy:

📦 The Restaurant Analogy: Imagine walking into a restaurant just to order a quick cup of coffee. But before allowing you through the front door, the host hands you a heavy wheelbarrow containing all the kitchen pots, fifty-pound bags of flour, and the pizza oven, forcing you to carry them all just to sit down and read the menu.

That was precisely what we were doing to our visitors' browsers. When someone landed on our home page simply to see what ClearCut Studio was about, their browser was being forced to download and process:

[User visits the homepage]
       │
       ├── 🔴 Download 6.04 MB favicon.svg in the <head> ........... 6.04 MB!
       ├── 🔴 Download a monolithic JS bundle with 8 full apps ..... Megabytes of AI & WASM!
       ├── 🔴 Service Worker downloading in background ............. Over 35 MB of videos and mockups!
       ├── 🟠 Download uncompressed landing page images ............ Over 3.5 MB!
       └── 🟡 Download 5 separate font families .................... Duplicate fonts!
       │
[Result: Browser main thread frozen for 2 to 3 seconds]

Here are the 5 critical interventions we made to fix this from the ground up.


2. The Mystery of the 6 Megabyte Favicon 🕵️‍♂️

A favicon is that tiny icon you see in your browser tab. Typically, a favicon is between 16 and 96 pixels wide and rarely exceeds 10 to 15 Kilobytes.

When inspecting network requests in browser DevTools, we were stunned by a surreal entry:

GET /favicon/favicon.svg ─── 6,039,731 bytes (6.04 MB)

What happened?

In our layout.tsx file, we linked an SVG icon in the <head>:

<link rel="icon" href="/favicon/favicon.svg" type="image/svg+xml" />

Opening that file in a text editor revealed that it was not a clean vector icon. It had been generated by an automated design tool that embedded a massive 1528x1528 pixel PNG directly into the SVG as a base64 string, along with extensive C2PA content provenance metadata consisting of millions of repetitive characters.

Because browsers parse the <head> tag before painting the page, Chrome, Safari, and Firefox were pausing the entire page render to download 6 full Megabytes of an icon before continuing.

The fix:

We replaced this bloated file with an optimized, lightweight SVG scaled cleanly to 96x96 pixels with zero residual metadata.

  • Before: 6,039,731 bytes (~6 MB).
  • After: 12,109 bytes (~12 KB).
  • Immediate savings: 99.8% weight reduction.

3. Dynamic Code Splitting: Keeping Heavy Tools on the Shelf 🧰

ClearCut Studio is far more than a static webpage; it features 8 pro-grade tools:

  1. Local AI Background Remover (@imgly/background-removal & ONNX Runtime).
  2. WebAssembly Image Optimizer (Squoosh / libavif / libwebp).
  3. Device Framer and Mockup Generator (html-to-image).
  4. Favicon & Manifest Suite (jszip).
  5. Aspect Ratio Resizer (Canvas API).
  6. Color Gradient Extractor (colorthief).
  7. EXIF Metadata Stripper (exifr).
  8. Batch Watermarker.

The Problem: The Monolithic Import in home-client.tsx

Originally, our main landing page component imported all 8 tools statically at the top of the file:

// ❌ BEFORE: Everything bundled into the initial page load
import BackgroundRemoverApp from "@/components/background-remover/background-remover-app";
import ImageOptimizerApp from "@/components/image-optimizer/image-optimizer-app";
import MockupGeneratorApp from "@/components/mockup-generator/mockup-generator-app";
// ... 5 more tools

This caused Webpack and Next.js to compile all the AI neural network weights, WebAssembly encoders, and file manipulation libraries into the initial JavaScript bundle for the homepage. The browser had to download, parse, and execute megabytes of complex editing code before letting the visitor even scroll through the landing page.

The Solution: Dynamic Imports (next/dynamic)

We implemented Code Splitting. Instead of loading every tool upfront, we tell the browser: "Do not download the AI background remover or image compressor until the user actually clicks to use it".

//  AFTER: On-demand lazy loading
import dynamic from "next/dynamic";

const ToolLoadingFallback = () => (
  <div className="min-h-screen flex items-center justify-center bg-background">
    <div className="w-10 h-10 border-4 border-primary border-t-transparent rounded-full animate-spin" />
  </div>
);

const BackgroundRemoverApp = dynamic(
  () => import("@/components/background-remover/background-remover-app"),
  { ssr: false, loading: ToolLoadingFallback }
);

const ImageOptimizerApp = dynamic(
  () => import("@/components/image-optimizer/image-optimizer-app"),
  { ssr: false, loading: ToolLoadingFallback }
);

The impact: The initial JavaScript bundle for the landing page dropped by over 70%. The homepage now pops up instantly. If a visitor decides to launch a tool, it loads smoothly on demand with a lightweight spinner.


4. The Runaway Service Worker: Stopping a 35 MB Background Frenzy 🛑

To allow ClearCut to function offline as a Progressive Web App (PWA), we use Serwist. Service Workers cache critical files in the browser so that the app continues to work even if you lose internet connectivity.

However, we spotted an unintended default in next.config.mjs:

// Default Serwist configuration
const withSerwist = withSerwistInit({
  swSrc: "app/sw.ts",
  swDest: "public/sw.js",
  // default globPublicPatterns: ["**/*"] 💥
});

With globPublicPatterns defaulting to ["**/*"], Serwist assumed it should eagerly precache every single file inside the public/ directory.

The moment a user loaded our homepage, the Service Worker kicked off an aggressive background downloading marathon:

  • Two .mp4 video demos totaling over 2.4 MB.
  • High-resolution 4K device mockups for iMacs, MacBooks, and Dell monitors (over 12 MB).
  • Heavy WebAssembly encoder binaries (avif_enc.wasm, etc.) over 5 MB.
  • Large promo images.

The browser was simultaneously attempting to pull down over 35 Megabytes of assets while trying to render the hero section, starving the main network thread and spiking CPU usage.

The Solution:

We configured globPublicPatterns in next.config.mjs to be laser-targeted:

const withSerwist = withSerwistInit({
  swSrc: "app/sw.ts",
  swDest: "public/sw.js",
  disable: process.env.NODE_ENV === "development",
  globPublicPatterns: [
    "favicon/*",
    "logos/*",
  ],
});

Now, the Service Worker only precaches essential branding and offline assets. Large device frames and WASM binaries are fetched strictly when their respective tools are opened.


5. Visual Surgery: Smart Compression and Lazy Loading 🖼️

Our landing page includes several demo images showcasing privacy and compression features. However, some were needlessly large:

  1. Security Graphic (secure-by-default.png): Was 1.83 MB despite being displayed inside a small 450px card. We resized and converted it into an optimized graphic weighing just 89 KB (a 95.1% reduction).
  2. Demo Cat Image (cat.png): Was 721 KB. Converted to an optimized file weighing 89 KB (an 87.6% reduction).
  3. Lazy Loading (loading="lazy"): Rather than requesting every showcase image immediately, we added native browser attributes:
<img
  src="/demos/example.jpg"
  loading="lazy"
  decoding="async"
  alt="Example"
/>

And for our main hero image (above the fold), we gave it top priority:

<img
  src="/demos/demo-original.png"
  fetchpriority="high"
  decoding="async"
  alt="Original"
/>

This instructs the browser: "Render the hero image instantly, and hold off on downloading images further down the page until the user scrolls towards them".


6. Font Diet: Purging Ghost Typographies ✍️

When auditing font requests, we noticed 5 separate font families loading at once:

  • Inter and Outfit (fetched from Google Fonts via next/font/google).
  • Urbanist, Albert Sans, and Caveat (loaded locally via @fontsource-variable).

Looking at globals.css, ClearCut's design tokens were set to use Urbanist (headings), Albert Sans (body), and Caveat (testimonials).

Inter and Outfit were leftover imports in layout.tsx from an earlier design iteration. They were "ghost fonts": downloaded on every page load, yet never rendered on a single word.

We deleted them cleanly, cutting out two render-blocking HTTP requests and saving over 80 KB of font data.


7. The Scorecard: Before vs. After 📊

Audited ElementBefore OptimizationAfter OptimizationImprovement
Favicon in <head>6,039,731 bytes (~6 MB)12,109 bytes (~12 KB)-99.8% transfer
JS ArchitectureHeavy synchronous monolithDynamic Code Splitting (next/dynamic)-70% initial JS
Service Worker Precache>35 MB in background< 2 MB (essentials only)-30 MB freed
Security Graphic1,830,600 bytes (1.83 MB)89,161 bytes (89 KB)-95.1% transfer
Demo Cat Image721,697 bytes (721 KB)89,421 bytes (89 KB)-87.6% transfer
Fonts5 families loaded3 active families-2 blocking requests
Perceived Load Time2.5 to 3.2 secondsNear-instantaneous (< 400ms)~8x faster

Key Takeaways

Web performance optimization is rarely about throwing out your framework and rebuilding from scratch. In most real-world projects, sluggishness is the result of silent, compounding oversights:

  • A graphic exported with oversized dimensions or embedded metadata.
  • Heavy interactive tools imported into a simple presentation view.
  • Default PWA settings that attempt to cache the entire universe.

At ClearCut Studio, we proved that client-side privacy and extreme speed are not mutually exclusive: when you respect every byte and architect with modularity, users get the absolute best of both worlds.

Visit our homepage and experience the instant speed for yourself!

Try it in your browser

Put these techniques into practice in ClearCut Studio

Remove backgrounds with AI, compress into AVIF/WebP, or strip EXIF metadata locally and for free.

Open Studio
Keep reading

Related articles

View all →