Performance: Global properties and methods
MEDIUM IMPACT
Global properties and methods affect initial app load and runtime performance by adding shared reactive or non-reactive data accessible across components.
import { heavyFunction } from './utils'; // Use heavyFunction only where needed inside components
app.config.globalProperties.$utils = { heavyFunction: () => { /* large code */ } }| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Large globalProperties object | 0 (no DOM changes) | 0 | 0 | [!] OK but costly in JS execution and memory |
| Scoped imports in components | 0 | 0 | 0 | [OK] Minimal JS overhead, better load performance |