Just thought about this a bit further:
If you are concerned for redundant calculation due to multiple calls to a function another possibility would be using render targets.
It keeps the results and gets only updated when you want it to. This may require a bit more logic to it than a straight forward var declaration but should work.