Cumhdaíonn optamú feidhmíochta Vue méid an bhundle, éifeachtúlacht an bhreisithe, agus costas an bhreachnochta. Seo na teicníochtaí is thábhachtaí.
1. Code splitting / lazy loading
routes = [{ : , : () }];
= ( ());
Cumhdaíonn optamú feidhmíochta Vue méid an bhundle, éifeachtúlacht an bhreisithe, agus costas an bhreachnochta. Seo na teicníochtaí is thábhachtaí.
routes = [{ : , : () }];
= ( ());
An bua is mór don shlad tosaigh: ná seol an cód nach bhfuil an úsáideoir ag fáiltiú a thuilleadh fós.
<div v-show="tab === 'a'"> <!-- toggled often → cheap CSS flip -->
<div v-if="rarelyShown"> <!-- rarely rendered → skip building it -->
<li v-for="item in items" :key="item.id"> <!-- enables efficient DOM reuse/diffing -->
import { shallowRef, shallowReactive } from "vue";
// for large objects you replace wholesale (or 3rd-party instances), skip deep tracking
const bigData = shallowRef(hugeObject); // only .value reassignment is reactive
Object.freeze(staticConfig); // never-changing data → no reactivity overhead
Tá an bhreachnocht dhomhain ar réada ollmhór costasach; cuireann shallowRef/shallowReactive/Object.freeze ar cheal a bheith ag súil le sonraí nach bhfuil gá dóibh.
<p>{{ expensiveComputed }}</p> <!-- cached, recomputes only on dependency change -->
<header v-once>{{ siteName }}</header> <!-- render once, never update -->
<div v-memo="[item.id]">...</div> <!-- re-render only if item.id changes -->
Rendering 10,000 rows kills performance → use vue-virtual-scroller / TanStack Virtual
to render only the visible rows.
Vue DevTools (component render timings, why a component re-rendered)
build output / rollup-plugin-visualizer → bundle composition
Lighthouse → Core Web Vitals
Tá Vue tapa ar bhonn réamhshocraithe, ach tá gá ag feidhmchláir mhóra le optamú cuimhneach: lazy-load chun bunkéilí a laghdú, roghnaigh v-if/v-show i gceart, úsáid eochracha cobhsaí, seachain os-bhreachnochta ar shonraí móra (shallowRef/freeze), taisce le computed/v-memo, agus virtualáil liostai fada.
A bheith ar eolas cén teicníc a thuairimíonn cén ráthaítín — agus tomhas le DevTools/Lighthouse seachas a bheith ag tabhair faoi dhéara — is é sin a choinníonn feidhmchlár Vue a fhás ag freagairt.