Question presented to candidate: "Users say our Vue dashboard feels sluggish: the first load is slow, and typing in a filter box lags. How would you approach making it faster? Tell me what you would measure and which Vue techniques you would reach for."
What a strong answer should cover:
- Measure first: browser performance profile, Vue DevTools,
app.config.performance, bundle analysis, and Core Web Vitals (LCP, INP). - Load performance: code splitting with lazy routes and
defineAsyncComponent, tree-shaking, SSR or prerendering where first paint matters, lazy hydration. - Update performance: keep child props stable so Vue can skip re-renders, derive with
computed, pass primitives rather than whole objects,v-memo/v-oncefor expensive stable subtrees. - Reactivity cost:
shallowRef/markRawfor large or external data, avoiding deep reactivity on big arrays. - Large lists: virtual scrolling instead of rendering thousands of rows; stable
:keys. - Other:
v-showvsv-iffor frequent toggles,KeepAlivefor expensive views, debouncing input, avoiding work in watchers.
Clarifying questions expected:
- "Is the problem initial load, interaction latency, or memory over time?"
- "How large is the data, and how often does it change?"
Code / implementation expected: Optional β an example of a child that re-renders needlessly and the fix.