View-Model icon indicating copy to clipboard operation
View-Model copied to clipboard

render() builds vars that aren't used

Open sfgeorge opened this issue 15 years ago • 1 comments
trafficstars

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.

sfgeorge avatar Sep 24 '10 17:09 sfgeorge

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.

zombor avatar Sep 24 '10 20:09 zombor