(on Tuesday, 14 April 2009, 01:12 AM -0700):
> Would there be significant performance issues with storing all this extra
> stuff in the registry, every hit? While I appreciate you can prevent it
> being stored by dropping the return value, you don't want to be altering
> your reusable code on every project depending on whether you need the
> resource later.
No, there shouldn't be much if any performance hit.
First off, as you note, if you don't return anything from the resource
method or plugin, nothing will be stored. That's the simplest way to
reduce any impact. Don't return something unless you know you'll need to
use it elsewhere in your applicaiton.
Second, it's basically just like using Zend_Registry to store objects
for later use in your application -- the only difference is that it's a
local instead of a static registry (which will make testing and
encapsulation easier).
Third, as Keith Pope noted, you'll typically return objects -- which
will be stored by reference, incurring no memory overhead.
--
Matthew Weier O'Phinney
Project Lead | matthew@zend.com
Zend Framework | http://framework.zend.com/
没有评论:
发表评论