Performance: Why Vue performance matters
HIGH IMPACT
Vue performance affects how fast the page loads and how smoothly users can interact with the app.
<template>
<ul>
<li v-for="item in items" :key="item.id"> {{ item.name }} </li>
</ul>
</template><template>
<ul>
<li v-for="item in items" :key="Math.random()"> {{ item.name }} </li>
</ul>
</template>| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Random keys in v-for | Recreates all nodes each update | N reflows per update | High paint cost | [X] Bad |
| Stable unique keys in v-for | Reuses nodes efficiently | Single reflow per update | Low paint cost | [OK] Good |