{"action":"created","issue":{"url":"https://api.github.com/repos/zendframework/zend-servicemanager/issues/122","repository_url":"https://api.github.com/repos/zendframework/zend-servicemanager","labels_url":"https://api.github.com/repos/zendframework/zend-servicemanager/issues/122/labels{/name}","comments_url":"https://api.github.com/repos/zendframework/zend-servicemanager/issues/122/comments","events_url":"https://api.github.com/repos/zendframework/zend-servicemanager/issues/122/events","html_url":"https://github.com/zendframework/zend-servicemanager/issues/122","id":157251391,"number":122,"title":"v3 performance while registering services factories and aliases","user":{"login":"pine3ree","id":3229979,"avatar_url":"https://avatars.githubusercontent.com/u/3229979?v=3","gravatar_id":"","url":"https://api.github.com/users/pine3ree","html_url":"https://github.com/pine3ree","followers_url":"https://api.github.com/users/pine3ree/followers","following_url":"https://api.github.com/users/pine3ree/following{/other_user}","gists_url":"https://api.github.com/users/pine3ree/gists{/gist_id}","starred_url":"https://api.github.com/users/pine3ree/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pine3ree/subscriptions","organizations_url":"https://api.github.com/users/pine3ree/orgs","repos_url":"https://api.github.com/users/pine3ree/repos","events_url":"https://api.github.com/users/pine3ree/events{/privacy}","received_events_url":"https://api.github.com/users/pine3ree/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/zendframework/zend-servicemanager/labels/question","name":"question","color":"cc317c"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2016-05-27T17:09:33Z","updated_at":"2016-06-07T21:20:37Z","closed_at":"2016-06-07T21:20:37Z","body":"Working with zend-expressive i found out that migrating to a newer version that included servicemanage 3 the very same test app was much slower. This occurred when registering all zend-form helper plugins.\r\n\r\nhttps://github.com/zendframework/zend-expressive-zendviewrenderer/issues/25\r\nhttps://github.com/zendframework/zend-form/issues/76\r\n\r\nSo i decided to prepare and run 2 simple test scripts whose only purpose is to register all zend-form view helpers using zend-servicemanager v2 and v3 and explain the issue here as I believe this repo is more appropriate for this.\r\n\r\n##### v3 test: zend-form configuration time ~ 22 ms (PHP 7.0), ~52-70 ms (PHP 5.6)\r\n```\r\ncd /my/test/path/sm3\r\ncomposer require zend-servicemanager:3.0.*\r\ncomposer require zend-i18n\r\ncomposer require zend-form\r\ncomposer require zend-view\r\n```\r\n\r\n```php\r\n<?php\r\n// file /my/test/path/sm3/test.php\r\nrequire 'vendor/autoload.php';\r\n\r\nuse Zend\\ServiceManager\\ServiceManager;\r\nuse Zend\\ServiceManager\\Config;\r\nuse Zend\\I18n\\View\\HelperConfig as I18nViewHelperConfig;\r\nuse Zend\\Form\\View\\HelperConfig as FormViewHelperConfig;\r\nuse Zend\\View\\HelperPluginManager;\r\n\r\n$serviceManager = new ServiceManager();\r\n$helperManager  = new HelperPluginManager($serviceManager);\r\n\r\n(new I18nViewHelperConfig())->configureServiceManager($helperManager);\r\n\r\n$t0 = microtime(true);\r\n(new FormViewHelperConfig())->configureServiceManager($helperManager);\r\n$ms = 1000 * round(microtime(true) - $t0, 5) . ' ms';\r\n\r\necho 'zend-servicemanager-v3 => ' . $ms . PHP_EOL;\r\n```\r\n\r\n```\r\n$ php70 test.php # ~ 22 ms\r\n$ php56 test.php # ~52-70 ms\r\n```\r\n\r\n##### v2 test: zend-form configuration time < 2ms (PHP 7.0), ~7-9 ms (PHP 5.6)\r\n```\r\ncd /my/test/path/sm2\r\ncomposer require zend-servicemanager:2.7.*\r\ncomposer require zend-i18n\r\ncomposer require zend-form\r\ncomposer require zend-view\r\n```\r\n\r\n```php\r\n<?php\r\n// file /my/test/path/sm2/test.php\r\nrequire 'vendor/autoload.php';\r\n\r\nuse Zend\\ServiceManager\\ServiceManager;\r\nuse Zend\\ServiceManager\\Config;\r\nuse Zend\\I18n\\View\\HelperConfig as I18nViewHelperConfig;\r\nuse Zend\\Form\\View\\HelperConfig as FormViewHelperConfig;\r\nuse Zend\\View\\HelperPluginManager;\r\n\r\n$serviceManager = new ServiceManager();\r\n$helperManager  = new HelperPluginManager();\r\n$helperManager->setServiceLocator($serviceManager);\r\n\r\n(new I18nViewHelperConfig())->configureServiceManager($helperManager);\r\n\r\n$t0 = microtime(true);\r\n(new FormViewHelperConfig())->configureServiceManager($helperManager);\r\n$ms = 1000 * round(microtime(true) - $t0, 5) . ' ms';\r\n\r\necho 'zend-servicemanager-v2 => ' . $ms . PHP_EOL;\r\n```\r\n\r\n```\r\n$ php70 test.php # < 2ms\r\n$ php56 test.php # ~7-9 ms\r\n```\r\n\r\nAll the installed packages have the same version excluding zend-servicemanager\r\n\r\nany hint/help?\r\n\r\ncould this performance degradation be related to ServiceManager 3 configure() method, involving rewriting the alias arrays and performing inner tests on existing keys and called for every registered alias?\r\n\r\nor simply is there something wrong in my setup (all this started when overwriting/delegating a new HelperPluginManagerFactory/DelegatorFactory in zend-expressive https://github.com/zendframework/zend-expressive-zendviewrenderer/issues/25\r\nhttps://github.com/zendframework/zend-form/issues/76 my last comments)\r\n\r\nkind regards\r\n\r\nPS\r\nforgot to mention that in the zend-expressive test app I obviously use zend opcode cache ext."},"comment":{"url":"https://api.github.com/repos/zendframework/zend-servicemanager/issues/comments/224418163","html_url":"https://github.com/zendframework/zend-servicemanager/issues/122#issuecomment-224418163","issue_url":"https://api.github.com/repos/zendframework/zend-servicemanager/issues/122","id":224418163,"user":{"login":"pine3ree","id":3229979,"avatar_url":"https://avatars.githubusercontent.com/u/3229979?v=3","gravatar_id":"","url":"https://api.github.com/users/pine3ree","html_url":"https://github.com/pine3ree","followers_url":"https://api.github.com/users/pine3ree/followers","following_url":"https://api.github.com/users/pine3ree/following{/other_user}","gists_url":"https://api.github.com/users/pine3ree/gists{/gist_id}","starred_url":"https://api.github.com/users/pine3ree/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pine3ree/subscriptions","organizations_url":"https://api.github.com/users/pine3ree/orgs","repos_url":"https://api.github.com/users/pine3ree/repos","events_url":"https://api.github.com/users/pine3ree/events{/privacy}","received_events_url":"https://api.github.com/users/pine3ree/received_events","type":"User","site_admin":false},"created_at":"2016-06-07T21:20:37Z","updated_at":"2016-06-07T21:20:37Z","body":"fixed by :\r\nhttps://github.com/zendframework/zend-form/pull/77\r\nhttps://github.com/zendframework/zend-i18n/pull/47"}}
{"actor":{"display_login":"pine3ree"}}