Vue.js Developer interview question · Most asked
How do you optimise the performance of a Vue application?
Summary
Measure first (Vue Devtools performance timeline, browser profiler, Lighthouse), then: reduce bundle size (lazy routes, tree-shaking, analysing dependencies), avoid unnecessary re-renders (stable props, computed values, v-once / v-memo for static or rarely changing subtrees), virtualise long lists, use shallowRef for large immutable data, and server-render or pre-render pages that need fast first paint.
Longer Answer
Common culprits: rendering thousands of rows (use a virtual scroller), passing new object or array literals as props on every render (child re-renders), deep watchers on large objects, making huge third-party objects deeply reactive (wrap with markRaw or shallowRef), and heavy work in computed properties that depend on frequently changing state.
Vue's compiler already optimises templates (static hoisting, patch flags), so focus on data size, reactivity scope and component granularity rather than micro-memoisation.
Key Points
- Measure first.
- Lazy loading and bundle analysis.
- Virtual lists; shallowRef/markRaw for big data.
- v-once / v-memo; stable props.
More most-asked Vue.js Developer questions
- Options API or Composition API: what is the difference, and which would you use?
- How do props work, and what is one-way data flow?
- How does Vue 3's reactivity system work, and how does it differ from Vue 2's?
- computed, watch or watchEffect: when do you use each?
- ref or reactive: what is the difference, and when do you use each?
- How do you use Vue Router: dynamic routes, nested routes and navigation guards?
- Why does v-for need a key, and why should it not be the index?
- What are composables, and why did they replace mixins?