View-Model
View-Model copied to clipboard
render() builds vars that aren't used
The current version of render() foreach-es on all of the ClassView's var_ properties and methods, regardless of whether the current view needs them or not. This can degrade performance when you have a situation with multiple views to a single ViewClass - it always builds all of the vars for all views.
It'd be great if - as the view is parsed - vars are fetched on-demand. If the same $var is referenced twice in a view, the previous value could be returned quickly from $_data.
This is one of those things that using a php engine doesn't really easily offer. It can be done with pre-processing of the template, but at that point you might as well be using mustache, for all the things that it offers above that.