{"action":"created","issue":{"url":"https://api.github.com/repos/twigphp/Twig/issues/1810","labels_url":"https://api.github.com/repos/twigphp/Twig/issues/1810/labels{/name}","comments_url":"https://api.github.com/repos/twigphp/Twig/issues/1810/comments","events_url":"https://api.github.com/repos/twigphp/Twig/issues/1810/events","html_url":"https://github.com/twigphp/Twig/issues/1810","id":105788963,"number":1810,"title":"[1.21.1][PHP7][Performance] Twig_NodeTraverser","user":{"login":"hanikesn","id":630711,"avatar_url":"https://avatars.githubusercontent.com/u/630711?v=3","gravatar_id":"","url":"https://api.github.com/users/hanikesn","html_url":"https://github.com/hanikesn","followers_url":"https://api.github.com/users/hanikesn/followers","following_url":"https://api.github.com/users/hanikesn/following{/other_user}","gists_url":"https://api.github.com/users/hanikesn/gists{/gist_id}","starred_url":"https://api.github.com/users/hanikesn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hanikesn/subscriptions","organizations_url":"https://api.github.com/users/hanikesn/orgs","repos_url":"https://api.github.com/users/hanikesn/repos","events_url":"https://api.github.com/users/hanikesn/events{/privacy}","received_events_url":"https://api.github.com/users/hanikesn/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-10T11:39:24Z","updated_at":"2015-09-11T07:24:20Z","closed_at":null,"body":"I'm currently in the progress in making our codebase ready for PHP7 and found a serious performance regression. Clearing the cache of our Symonfy application takes 8 times longer. I tried to track it down and found out that most time is spent in `Twig_NodeTraverser`. I added the following code to `\\Twig_Parser::parse`:\r\n```\r\nPHP_Timer::start();\r\n$node = $traverser->traverse($node);\r\nself::$traverse += PHP_Timer::stop();\r\n```\r\nAnd here's my output:\r\n```\r\n$ time ~/misc/php/bin/php ./console cache:clear \r\nClearing the cache for the dev environment with debug true\r\nTraverse 2.4 minutes\r\n\r\nreal    2m41.792s\r\nuser    2m40.563s\r\nsys     0m1.100s\r\n$ time php ./console cache:clear \r\nClearing the cache for the dev environment with debug true\r\nTraverse 8.86 seconds\r\n\r\nreal    0m21.854s\r\nuser    0m21.103s\r\nsys     0m0.710s\r\n```\r\n\r\nI guess this is a problem within PHP, but we need to start somewhere to track it down."},"comment":{"url":"https://api.github.com/repos/twigphp/Twig/issues/comments/139471431","html_url":"https://github.com/twigphp/Twig/issues/1810#issuecomment-139471431","issue_url":"https://api.github.com/repos/twigphp/Twig/issues/1810","id":139471431,"user":{"login":"sstok","id":904790,"avatar_url":"https://avatars.githubusercontent.com/u/904790?v=3","gravatar_id":"","url":"https://api.github.com/users/sstok","html_url":"https://github.com/sstok","followers_url":"https://api.github.com/users/sstok/followers","following_url":"https://api.github.com/users/sstok/following{/other_user}","gists_url":"https://api.github.com/users/sstok/gists{/gist_id}","starred_url":"https://api.github.com/users/sstok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sstok/subscriptions","organizations_url":"https://api.github.com/users/sstok/orgs","repos_url":"https://api.github.com/users/sstok/repos","events_url":"https://api.github.com/users/sstok/events{/privacy}","received_events_url":"https://api.github.com/users/sstok/received_events","type":"User","site_admin":false},"created_at":"2015-09-11T07:24:20Z","updated_at":"2015-09-11T07:24:20Z","body":"The `Twig_NodeTraverser` hasn't changed much since 2014 so it's properly related to one or more NodeVisitors."}}