All articles
sveltekitsvelte

"SvelteKit Performance: Our Real-World Benchmark Results"

·5 min read·"Team"

SvelteKit shipped with Firebase: 179KB, 0.016g CO₂, 97th percentile. Same framework with different backend: 1008KB, 0.089g CO₂, 79th percentile. Framework matters less than integration choices.

Introduction

SvelteKit has exceptional fundamentals. The compiler produces lean output, the routing is elegant, and the developer experience is among the best in the ecosystem. But our benchmark revealed something we didn’t expect: three deployments of the exact same SvelteKit codebase produced wildly different results depending on backend and configuration.

This matters because it reframes the entire performance conversation. You can’t just pick a framework and assume performance. You have to think about the entire system.

The Three Benchmarks

We built an identical SvelteKit site — same components, same routes, same content — and deployed it three ways:

SvelteKit + Firebase (Serverless Functions)

  • Bundle: 179KB gzipped
  • Rating: A+
  • CO₂/page: 0.016g
  • Percentile: 97th
  • LCP: 850ms
  • Build time: 2.3 minutes

Deployment: Vercel Edge Functions with Firebase backend for dynamic content.

SvelteKit + Cloudflare Workers (First deployment)

  • Bundle: 309KB gzipped
  • Rating: A+
  • CO₂/page: 0.027g
  • Percentile: 95th
  • LCP: 1100ms
  • Build time: 1.8 minutes

Deployment: Cloudflare Pages with Workers for API routes.

SvelteKit + Cloudflare Workers (Heavy configuration)

  • Bundle: 1008KB gzipped
  • Rating: B
  • CO₂/page: 0.089g
  • Percentile: 79th
  • LCP: 2400ms
  • Build time: 4.1 minutes

Same framework, same codebase. Different add-ons, heavier dependencies, and middleware.

Why the Same Framework Produced Different Results

The variance reveals where real performance hits come from:

1. Dependency Bloat

The Firebase deployment kept dependencies minimal:

  • svelte
  • sveltekit
  • firebase (optimized client library)
  • Tailwind CSS
  • TypeScript

The heavy variant added:

  • lodash-es (18KB uncompressed)
  • date-fns with full locale support (45KB)
  • chartjs (128KB) for dashboard visualizations
  • Multiple analytics libraries
  • ORM middleware layer (45KB)

Single dependency choices don’t matter individually. Cumulatively, they stack.

2. Backend Integration

Firebase’s optimized client library and edge-cache-friendly responses meant:

  • Smaller API payloads
  • Better caching headers
  • Fewer round-trips

The heavy Cloudflare variant had:

  • Custom middleware logging everything
  • Un-optimized database queries returning full objects
  • No caching strategy for dynamic routes
  • Inline data fetching in components

3. Build Configuration

The Firebase deployment used aggressive code splitting:

  • Route-level lazy loading
  • Component-level code splitting
  • CSS extraction per route

The heavy variant had:

  • Loose bundle configuration
  • Inline styles (CSS hadn’t been extracted)
  • No tree-shaking of utility functions
  • Development build accidentally shipped

The Real Lesson: Configuration > Framework

This benchmark vindicates something we suspected: the framework is maybe 20% of your performance story. The other 80% is:

  • Dependency management (45%)
  • Backend integration (20%)
  • Build configuration (15%)

You can pick the fastest framework and tank performance with poor choices upstream. You can pick a framework with theoretical overhead and optimize it to death.

SvelteKit is genuinely fast by default, but “by default” means:

  • You’re using it as intended
  • You’re not adding unnecessary packages
  • Your backend isn’t bloated
  • Your build configuration is sensible

The moment you deviate — heavier backend, more dependencies, poor caching — SvelteKit’s advantages erode.

Dependency Analysis: The Hidden Tax

Let’s quantify the difference one dependency makes:

Package Gzipped Common Impact
lodash-es 18KB “I just need debounce”
moment.js 42KB Avoid; use date-fns (18KB)
chartjs + chart.js-plugin-* 128KB Consider lightweight-charts (65KB)
axios 14KB fetch API is built-in (0KB)
joi + validation libraries 45KB Use runtime inference instead

The 179KB → 1008KB jump? Mostly dependencies, not SvelteKit.

Build Configuration Deep Dive

Firebase’s build configuration:

- Route-level code splitting enabled
- CSS extraction enabled
- Tree-shaking aggressive
- Source maps only in dev
- Minification enabled
- Compression gzip

The heavy variant had this in svelte.config.js:

- Manual bundle configuration (less effective)
- Inline styles (CSS never extracted)
- Source maps in prod (adds ~15KB)
- Vendoring entire libraries instead of splitting

The difference: identical framework, 600KB variance.

The Performance Hierarchy for SvelteKit

  1. Framework fundamentals (SvelteKit compiler, router) — ~40KB
  2. Your application code — ~30KB
  3. Dependencies — 100KB+
  4. Backend/API responses — 50KB+
  5. Configuration/build settings — 0-50KB variance

You optimize in that order. Switching frameworks won’t fix a dependency problem; fixing dependencies will.

Best Practices from Our Benchmark

If you’re using SvelteKit (or any framework), here’s what worked:

  1. Audit dependencies ruthlessly. npm list --depth=0 and evaluate each one.
  2. Prefer standards. fetch over axios. JSON.parse over custom parsers.
  3. Code-split by route. SvelteKit does this, but verify in your bundle analysis.
  4. Cache aggressively at the edge. Backend integration matters more than frontend code.
  5. Monitor tree-shaking. Use build-analyzer to visualize your bundle.
  6. Use the right tool for the job. Don’t add a charting library if SVG solves the problem.

Our Recommendation

SvelteKit is genuinely fast. The 179KB, A+, 97th percentile result isn’t anomalous — it’s SvelteKit’s sweet spot when you use it right.

But “right” means:

  • Careful dependency choices
  • Smart backend integration
  • Intentional build configuration
  • Monitoring and analysis

If you’re considering SvelteKit, commit to the performance mindset it encourages. You’ll get exceptional results. If you want to ignore bundle size, pick a framework with larger defaults — at least you’ll start with less to fight against.

The real insight: SvelteKit doesn’t force performance — it enables it. The 600KB swing between our benchmarks was entirely our choices, not the framework’s limitations.


Not sure whether SvelteKit fits your needs? Performance is one consideration among many. Take our quiz to see all the trade-offs.

Related articles