{"action":"created","issue":{"url":"https://api.github.com/repos/piwik/device-detector/issues/5307","labels_url":"https://api.github.com/repos/piwik/device-detector/issues/5307/labels{/name}","comments_url":"https://api.github.com/repos/piwik/device-detector/issues/5307/comments","events_url":"https://api.github.com/repos/piwik/device-detector/issues/5307/events","html_url":"https://github.com/piwik/device-detector/issues/5307","id":55548985,"number":5307,"title":"Extremely low performance","user":{"login":"MaxBaldin","id":9378386,"avatar_url":"https://avatars.githubusercontent.com/u/9378386?v=3","gravatar_id":"","url":"https://api.github.com/users/MaxBaldin","html_url":"https://github.com/MaxBaldin","followers_url":"https://api.github.com/users/MaxBaldin/followers","following_url":"https://api.github.com/users/MaxBaldin/following{/other_user}","gists_url":"https://api.github.com/users/MaxBaldin/gists{/gist_id}","starred_url":"https://api.github.com/users/MaxBaldin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MaxBaldin/subscriptions","organizations_url":"https://api.github.com/users/MaxBaldin/orgs","repos_url":"https://api.github.com/users/MaxBaldin/repos","events_url":"https://api.github.com/users/MaxBaldin/events{/privacy}","received_events_url":"https://api.github.com/users/MaxBaldin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-01-26T22:46:41Z","updated_at":"2015-03-06T09:30:22Z","closed_at":null,"body":"Hello! Here is the code(as in example):\r\n```php\r\n<?php\r\nuse DeviceDetector\\DeviceDetector;\r\nuse DeviceDetector\\Parser\\Device\\DeviceParserAbstract;\r\n\r\nrequire_once(\"../device-detector/vendor/autoload.php\");\r\n\r\nDeviceParserAbstract::setVersionTruncation(DeviceParserAbstract::VERSION_TRUNCATION_NONE);\r\n\r\n$dd = new DeviceDetector();\r\n\r\n$dd->setUserAgent(\"Mozilla/5.0 (Windows NT 6.3; WOW64; rv:35.0) Gecko/20100101 Firefox/35.0\");\r\n$dd->parse();\r\n\r\n$clientInfo = $dd->getClient();\r\nprint_r($clientInfo);\r\n```\r\n\r\nIt takes about **10 seconds** to parse one user-agent.\r\n\r\nphp -v result:\r\n```shell\r\nPHP 5.5.20 (cli) (built: Dec 17 2014 12:09:22)\r\nCopyright (c) 1997-2014 The PHP Group\r\nZend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies\r\n    with Xdebug v2.2.7, Copyright (c) 2002-2015, by Derick Rethans\r\n```\r\nphp extensions: redis, memcache, xdebug\r\noperation system: windows 8.1 x64.\r\n\r\nXdebug profiler snapshot: https://www.dropbox.com/s/mecp952mj5wocia/cachegrind.out.7z?dl=0\r\n\r\n99,6% takes method DeviceDetector\\DeviceDetector->parse with extremelly long preg_match calls(6.321 sec). \r\n\r\nI`m a bit confused, is it ok? Is this library only for raw data post-processing and not for real-time user-agent parsing?"},"comment":{"url":"https://api.github.com/repos/piwik/device-detector/issues/comments/77530423","html_url":"https://github.com/piwik/device-detector/issues/5307#issuecomment-77530423","issue_url":"https://api.github.com/repos/piwik/device-detector/issues/5307","id":77530423,"user":{"login":"ThaDafinser","id":533017,"avatar_url":"https://avatars.githubusercontent.com/u/533017?v=3","gravatar_id":"","url":"https://api.github.com/users/ThaDafinser","html_url":"https://github.com/ThaDafinser","followers_url":"https://api.github.com/users/ThaDafinser/followers","following_url":"https://api.github.com/users/ThaDafinser/following{/other_user}","gists_url":"https://api.github.com/users/ThaDafinser/gists{/gist_id}","starred_url":"https://api.github.com/users/ThaDafinser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ThaDafinser/subscriptions","organizations_url":"https://api.github.com/users/ThaDafinser/orgs","repos_url":"https://api.github.com/users/ThaDafinser/repos","events_url":"https://api.github.com/users/ThaDafinser/events{/privacy}","received_events_url":"https://api.github.com/users/ThaDafinser/received_events","type":"User","site_admin":false},"created_at":"2015-03-06T09:30:22Z","updated_at":"2015-03-06T09:30:22Z","body":"I use it on windows (production) and dont have problems with it....when cache enabled"}}