That kind of performance optimization should be applied automatically.
It's a welcomed addition for advanced developers but it should be the machine's job.
I think frameworks like SolidJS or Svelte are one step ahead in that regards. As far as I understand, they can surgically update the DOM without having to re-render the whole component.
I wonder if Vue 4 will still use a Virtual DOM.
Speaking from a React perspective at least, I think it's not the default because technically nothing stops someone from writing really smelly, non-idiomatic code where memoizing it could cause logic errors. At the very least it would be a breaking API change
I'm with you, I think catering to those cases is a fool's errand, but I understand the argument for doing it.
If the machine could do it you wouldn't need to use a directive for it. It's not like Vue is doing no optimization at all behind the scenes; there's just only so much you can do that will still allow the developer to maintain 100% confidence in the framework.
That's exactly what Vue does (unlike say React). Only those parts of the VDOM are updated whose dependencies changed. v-memo is mostly for lists and cases where updates should be delayed for reasons like flickering.
Vue already tracks dependencies. V-memo is a special case where they want to react to values which are determined by user, instead of all react values used(default for Vue) .
I think frameworks like SolidJS or Svelte are one step ahead in that regards. As far as I understand, they can surgically update the DOM without having to re-render the whole component. I wonder if Vue 4 will still use a Virtual DOM.