Dyllen OwensAvailable
←All writing
Engineering3 min read

Performance Optimization: Beyond the Basics

After spending weeks shaving milliseconds off load times, I discovered that the real performance gains come from rethinking architecture entirely.

Engineering
RSS

I spent three weeks obsessing over a 200ms improvement in page load time. I minified, compressed, lazy-loaded, and cached. The result? A marginal improvement that users didn't even notice.

Then I made one architectural change that cut load time by 3 seconds.

This is the story of what actually moves the needle in performance optimization.

The Micro-Optimization Trap

When most developers think about performance, they think about:

  • Reducing bundle size
  • Optimizing images
  • Adding caching headers
  • Using a CDN

These matter. But they're often the equivalent of rearranging deck chairs on the Titanic. If your architecture is fundamentally slow, no amount of micro-optimization will save you.

Finding the Real Bottleneck

The first step in meaningful optimization is measurement. Not guessing. Not assuming. Measuring.

I use this hierarchy:

1. Network Waterfall

Open your browser's Network tab and look at the waterfall. What's the longest bar? What's blocking rendering? Often, the answer surprises you.

2. Server Timing

If your pages are server-rendered, add server timing headers. Break down where time is spent: database queries, template rendering, external API calls.

3. Real User Monitoring

Lab performance and real performance are different. Implement RUM to see what your actual users experience on actual devices with actual network conditions.

The Architectural Shift

In my case, the bottleneck was clear: we were making 12 database queries per page load, with some queries taking 400ms each. No amount of frontend optimization would fix backend bloat.

The solution was architectural:

  1. Query consolidation — Combine related queries into single, optimized queries
  2. Data normalization — Restructure the database to support our access patterns
  3. Caching layer — Introduce Redis for frequently-accessed, rarely-changing data
  4. Edge computing — Move computation closer to users with edge functions

The result: page loads went from 4.5 seconds to under 1 second.

The Performance Budget

After that experience, I implemented a performance budget for all future work:

  • First Contentful Paint: Under 1.5 seconds
  • Time to Interactive: Under 3.5 seconds
  • Total Bundle Size: Under 200KB (gzipped)
  • API Response Time: Under 200ms (95th percentile)

These aren't aspirational goals. They're enforced in CI. Deployments fail if they violate the budget.

Optimization Techniques That Actually Work

Based on dozens of optimization projects, here are the techniques with the highest impact:

1. Reduce Round Trips

Every HTTP request has latency. Combine requests where possible. Use HTTP/2 multiplexing. Consider GraphQL to fetch exactly what you need in one request.

2. Move Work to Build Time

Anything you can compute at build time shouldn't happen at runtime. Static generation, pre-computed values, and build-time optimizations are essentially free performance.

3. Progressive Loading

Show something fast, then enhance. Skeleton screens, optimistic UI updates, and streaming HTML all create the perception of speed even when the full load takes time.

4. Eliminate, Don't Optimize

Before optimizing slow code, ask: does this code need to exist? The fastest code is code that never runs.

The Human Side

Performance isn't just a technical metric. It has real human impact:

  • Users on slow connections can actually use your app
  • Users with older devices aren't excluded
  • Users in emerging markets, where mobile data is expensive, aren't penalized

When you optimize for performance, you optimize for inclusion.

Your Next Steps

If you're working on performance, here's my suggested approach:

  1. Measure first. Don't optimize blindly.
  2. Look at architecture before looking at code.
  3. Set a budget and enforce it automatically.
  4. Test on real devices with real network conditions.
  5. Remember the humans behind the metrics.

Performance is a feature. Treat it like one.

Filed under: Engineering/ END /