Skip to main content

Angular Performance Optimization Playbook

Optimize Angular application performance — change detection, lazy loading, virtual scrolling, bundle size, and runtime profiling.

Fill in the placeholders

Edit the values, then copy your finished prompt.

Your Prompt
prompt.txt

                                

What this prompt does

This prompt runs a structured performance optimization playbook over an Angular [angular_version] app that has known [current_issues], aiming at concrete [performance_targets]. It works through change detection, lazy loading, @defer blocks, virtual scrolling, bundle reduction, image optimization, trackBy, Web Workers, SSR, and a runtime profiling workflow — and asks for before/after metrics on each step so the work is accountable.

It works because it attacks the usual sources of Angular slowness in order and ties each fix to your numbers. Migrating [cd_candidates] to OnPush cuts needless change-detection runs, splitting [module_count] routes into lazy chunks shrinks the initial load, and virtual scrolling keeps [list_component] smooth at [item_count]+ rows. Offloading [cpu_tasks] to a Web Worker stops heavy computation from blocking the main thread. Framing the work around moving from [current_bundle] to [target_bundle] and hitting [performance_targets] makes the output measurable rather than a list of generic tips.

When to use it

  • An Angular app feels slow and you need a prioritised plan, not scattered advice
  • Initial load is heavy and you want to lazy-load [module_count] routes with a preloading strategy
  • Data tables or lists janky at scale and [list_component] needs virtual scrolling
  • Bundle size has crept up and you need to get from [current_bundle] toward [target_bundle]
  • Migrating components to OnPush change detection across the app
  • Justifying optimization work to stakeholders with before/after [performance_targets] numbers

Example output

You get an ordered optimization plan: which [cd_candidates] to move to OnPush, a lazy-loading split for [module_count] routes with a preloading strategy, @defer block placement for below-the-fold content, virtual scrolling config for [list_component], a bundle-analysis and tree-shaking pass targeting [target_bundle], NgOptimizedImage usage, trackBy functions for every loop, Web Worker offloading for [cpu_tasks], SSR setup for [ssr_pages], and a DevTools/Chrome profiling workflow — each step paired with before/after metric placeholders.

Pro tips

  • State [current_issues] with real symptoms (4s load, janky table scroll, 2.5MB bundle) so the playbook targets your actual bottlenecks
  • Set [performance_targets] as measurable thresholds (LCP, INP, bundle size) because they decide which steps matter most
  • Pick [cd_candidates] carefully; OnPush helps most on frequently-rendered components like table rows and cards
  • Match [item_count] to your real data — virtual scrolling pays off at thousands of rows, less so at a few dozen
  • Add trackBy to every *ngFor or @for loop over dynamic data, since rebuilding DOM nodes needlessly is a quiet cause of jank
  • Reach for @defer blocks on below-the-fold or conditionally rendered content, so heavy components load only when they're actually needed
  • Treat the before/after metrics as required, not optional; measure with Angular DevTools and the Chrome Performance tab rather than guessing
  • Only enable SSR for [ssr_pages] that benefit (landing, blog, docs); rendering an authenticated dashboard server-side adds complexity for little gain

Frequently Asked Questions

Does this prompt give before-and-after performance numbers?
It structures each optimization to capture before/after metrics, but the actual numbers come from your profiling runs. You measure with Angular DevTools and the Chrome Performance tab; the prompt provides the framework and the placeholders to fill in.
Which components should I move to OnPush change detection?
List them in `[cd_candidates]`, focusing on components that render frequently, such as data table rows, cards, sidebars, and headers. OnPush gives the biggest wins where change detection currently runs too often, so target hot paths rather than every component.
When is virtual scrolling actually worth it?
Virtual scrolling helps when `[list_component]` renders large datasets, on the order of thousands of `[item_count]` rows. For short lists it adds complexity without meaningful benefit, so reserve it for tables and feeds that genuinely scroll through many items.
Does it require Angular SSR for the whole app?
No, it applies SSR only to the `[ssr_pages]` you name, typically public pages like landing, blog, and documentation. Authenticated, highly interactive dashboards often gain little from SSR and add hydration complexity, so it is intentionally scoped.
Engr Mejba Ahmed

Need this built for real?

Engr Mejba Ahmed

AI Developer · Software Engineer

I'm Mejba — I design and ship production AI systems, automations, and full-stack apps. If you want this turned into a working solution for your team, let's talk.

More in Vue.js & Angular Prompts

Engr Mejba Ahmed

Engr Mejba Ahmed

Claude Code Expert · Online

👋

Hey there!

Quick Actions

WhatsApp Instant reply

Chat on WhatsApp

+880 1723 741224 · Instant reply

Popular Questions

Engr Mejba Ahmed is connected
Engr Mejba Ahmed is typing...
Engr Mejba Ahmed avatar

✉ Want me to follow up? Drop your email

Engr Mejba Ahmed avatar

📞 Connect Directly

Choose how you'd like to reach me

WhatsApp

+880 1723 741224

Email

[email protected]

✓ Details sent! I'll get back to you shortly.

Powered by OpenAI

335+

Blog Posts

25

AI Courses

63

Projects

Services & Expertise

Pricing & Process

Learning & Resources

Connect & Support