-- nuxwin <l.decle...@nuxwin.com> wrote (on Thursday, 27 September 2012, 01:33 PM -0700): > Now, it's true that I've not performed any profiling on you code but it's > not really necessary here. I've pointed out the > *Zend\Mvc\View\Http\ViewManager* not really about the listeners that are > attached but more for the bunch of objects loaded on bootstrap event (method > *ViewManager::onBootstrap()*) and the involved work to load them. Ie, When > I see both the *RouteNotFoundStrategy* and the *ExceptionStrategy* objects > loaded and the related works done to load them, I'm bit annoyed because I > know that in most of the requests, these objects will never been used. That > was only my sentence here and I'm just wondering if we cannot found a > solution to avoid such work (that is potentially done for nothing on each > requests).
You can't trigger something without it already being attached as a listener. You're confusing instantiation and attachment of listeners with actually triggering them. Object instantiation is cheap in 5.3 (and moreso in 5.4); attachment of listeners is very cheap as well. It's not a huge issue performance-wise. If we moved the instantiation and attachment to when they're needed, we then have to do a whole bunch of specialized code within the RouteListener and DispatchListener -- right now, these are quite lean and primarily responsible for triggering events and handling exceptions, which they can do with no knowledge of what's actually listening. Also, these things were happening even when we were using DI, and before the ViewManager was born -- they were simply happening in the skeleton application. We've simply moved what had become a de facto workflow directly into the framework. Nothing has really changed in that respect. I'm open to ideas -- but I need to see more than assumptions and criticisms. There are reasons for most of the choices we've made. -- Matthew Weier O'Phinney Project Lead | matt...@zend.com Zend Framework | http://framework.zend.com/ PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc -- List: fw-general@lists.zend.com Info: http://framework.zend.com/archives Unsubscribe: fw-general-unsubscr...@lists.zend.com