Performance: Reactivity transform and limitations
MEDIUM IMPACT
This affects how Vue tracks reactive dependencies and updates the DOM efficiently during user interactions.
<script setup lang="ts" reactivity-transform> let count = $ref(0); function increment() { count++; } </script>
import { ref } from 'vue'; export default { setup() { const count = ref(0); function increment() { count.value++; } return { count, increment }; } }
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Explicit ref with .value | Minimal extra nodes | 1 reflow per update | Low paint cost | [OK] Good |
| Reactivity transform with primitives | Minimal extra nodes | 1 reflow per update | Low paint cost | [OK] Good |
| Reactivity transform with nested objects | Potential missed updates | Possible extra reflows due to manual fixes | Medium paint cost | [!] |
| Using reactive() for nested objects | Minimal extra nodes | 1 reflow per update | Low paint cost | [OK] Good |