Angular · Performance

The Angular performance checklist I run before every release

Performance work goes wrong when it starts with a tool. This is the order I work in: agree what “fast” means, measure it, fix the biggest cause, then make the fix impossible to regress.

Most Angular performance problems are not mysterious. They are ordinary decisions that were reasonable in isolation — one more shared module, one more third-party script, one more subscription — and became expensive in aggregate. A checklist helps because it forces the same questions on every release instead of only when a dashboard turns red.

This is the list I use, in the order I use it. It applies to Angular 16 and later, including current versions with signals and zoneless change detection.

1. Start with a budget, not a tool

A budget turns performance into an engineering constraint instead of a preference. Pick numbers that map to user experience, write them down, and treat a breach as a bug:

Measure Target Why this one
LCP (field, p75, mobile) ≤ 2.5 s The largest element is what users perceive as “loaded”.
INP (field, p75) ≤ 200 ms Captures the interaction delays that make an app feel sticky.
CLS (field, p75) ≤ 0.1 Layout jumps destroy trust, especially during checkout or data entry.
Initial route JavaScript Team-specific, e.g. ≤ 180 KB gzip Keeps parse and execution cost bounded on mid-tier phones.

The exact thresholds for Core Web Vitals come from Google’s published guidance; the JavaScript number is yours to set. What matters is that the budget is visible in review and checked automatically.

2. Measure before you touch anything

Lab tools tell you what could happen. Field data tells you what did. Use both, and keep them separate in your head:

  • Field: the Chrome UX Report or your own RUM collection, segmented by route, device class and country. A single site-wide average hides the checkout page that is three times slower than the marketing pages.
  • Lab: Lighthouse or the Performance panel against a throttled mid-tier profile. Useful for attribution and for catching regressions before users do.
  • Baseline: record the numbers before the change. Without a before, a “fast” result is just a feeling.

Do not optimise a lab score for its own sake. A 100 in Lighthouse with a slow server, an unstable layout and a blocked main thread is still a bad experience. Field metrics and real interaction traces decide.

3. Change detection is usually the biggest Angular lever

Angular is efficient by default, but a default component checks more often than most screens need. Three habits remove most of the waste:

  • Set ChangeDetectionStrategy.OnPush on every component. Make it the review default and justify exceptions.
  • Prefer signals, computed() and input() over mutable fields read from templates. Dependencies become explicit and updates become fine-grained.
  • Never call a function that builds or filters a collection directly from a template. Use a computed value or a pure pipe.
@Component({
  selector: 'app-orders',
  changeDetection: ChangeDetectionStrategy.OnPush,
  template: `
    @for (order of visibleOrders(); track order.id) {
      <app-order-row [order]="order" />
    }
  `
})
export class OrdersComponent {
  readonly orders = input.required<Order[]>();
  readonly filter = signal<string>('');

  readonly visibleOrders = computed(() => {
    const term = this.filter().trim().toLowerCase();
    return term
      ? this.orders().filter(o => o.customer.toLowerCase().includes(term))
      : this.orders();
  });
}

If the application is ready for it, zoneless change detection removes the monkey-patching of browser APIs and the broad checks that come with it. Adopt it deliberately: audit third-party code that assumes Zone.js, and make sure async state is expressed through signals or explicit change detection.

4. Ship less JavaScript

On mobile, JavaScript is the most expensive asset per byte: it must be downloaded, parsed, compiled and executed. The wins, roughly in order of impact:

  • Route-level lazy loading for every feature area, not just the largest one.
  • Defer what is below the fold with @defer. This is not only about the network; it also keeps heavy components out of the initial change-detection path.
  • Check the bundle graph, not just the total. A single barrel file or a shared module can pull an entire charting library into the first route.
  • Drop unused polyfills and keep the browser support matrix honest.
  • Load third parties after the app is interactive, and question each one. Analytics, chat widgets and A/B tools are often larger than the application code they measure.
@defer (on viewport) {
  <app-analytics-panel />
} @placeholder (minimum 200ms) {
  <div class="panel-skeleton" aria-hidden="true"></div>
} @error {
  <p>This panel could not load. <button (click)="retry()">Retry</button></p>
}

5. Choose the rendering strategy per route

Not every page needs the same treatment. Server-side rendering or prerendering is usually the right answer for the landing page, documentation and any route where the largest element should arrive as HTML. Authenticated dashboards may be better as client-rendered applications with a fast shell.

When you do render on the server, verify hydration: mismatched markup, browser-only APIs executed during render, and duplicated data requests all show up as jank or double work. Test with JavaScript throttled and with JavaScript disabled for the content that must be indexable.

6. Images, fonts and the LCP element

The largest contentful paint is often an image or a hero heading. Treat that element as a first-class performance concern:

  • Use NgOptimizedImage (or explicit srcset, sizes and dimensions) so the browser downloads an appropriately sized file.
  • Give every image intrinsic width and height to reserve space and prevent layout shift.
  • Set fetchpriority="high" on the LCP image only; lazy-load everything below the fold.
  • Preload the LCP image and the critical font, and nothing else. Over-preloading delays the resources that matter.
  • Use modern formats (AVIF, WebP) and compress at the size actually displayed.
  • Subset fonts, use font-display: swap, and match the fallback metrics to avoid a visible reflow.

7. Fix runtime cost: leaks, long tasks and big lists

A page can load quickly and still feel slow two minutes later. The usual causes are mundane:

  • Leaked subscriptions and listeners. Use takeUntilDestroyed() or the DestroyRef API, and remove DOM listeners in the same place they were added.
  • Long tasks on the main thread. Move parsing, sorting and heavy computation into a worker or behind an explicit loading state. Break up work that blocks input.
  • Unvirtualised lists. The Angular CDK virtual scroll (or pagination) keeps DOM size and change detection proportional to what is visible.
  • Repeated expensive formatting. Cache derived values instead of recalculating them for every row and every keystroke.

Take a memory snapshot before and after navigating away from a heavy route. If the heap keeps growing, you have a leak, and no amount of bundle optimisation will hide it.

8. Make delivery boringly good

Compression, caching and a CDN are not optional at scale. Serve hashed assets with a long Cache-Control, keep HTML short-lived, enable Brotli, and avoid redirect chains. Make sure the origin is close enough to users or fronted by a CDN. These are one-time fixes that keep paying out.

9. Put a guard on it

The final step is the one teams skip: make the improvement permanent.

  • A CI budget check on the initial bundle, with the build failing on a meaningful regression.
  • Lighthouse CI (or an equivalent lab check) on the routes that matter, not the whole site.
  • RUM alerts on p75 LCP and INP, segmented by route and device.
  • A named owner for performance, and a short checklist item in the pull-request template.
  • A quarterly review that deletes or replaces what is no longer used. Performance debt is mostly accumulation.

The pattern behind all of this is simple: make the user-visible metric the goal, use the framework properly, remove work rather than micro-optimising it, and automate the guard rail. That is how a Lighthouse score goes from 20 to 97 and stays there after the next ten features ship.

Related reading: the same measurement-first approach applied to Core Web Vitals, and the component-level quality checks in the WCAG 2.2 checklist.

Back to top