{"action":"created","comment":{"url":"https://api.github.com/repos/Microsoft/tolerant-php-parser/pulls/comments/152459535","pull_request_review_id":78324831,"id":152459535,"diff_hunk":"@@ -12,125 +12,79 @@ class DiagnosticsProvider {\n \n     private static $tokenKindToText;\n \n+    /**\n+     * @param int $kind (must be a valid token kind)\n+     * @return string\n+     */\n+    public static function getTextForTokenKind($kind) {\n+        if (!isset(self::$tokenKindToText)) {","path":"src/DiagnosticsProvider.php","position":9,"original_position":9,"commit_id":"873cfca9eb8cb6c209a2c499f24f433fdef0c697","original_commit_id":"873cfca9eb8cb6c209a2c499f24f433fdef0c697","user":{"login":"roblourens","id":323878,"avatar_url":"https://avatars3.githubusercontent.com/u/323878?v=4","gravatar_id":"","url":"https://api.github.com/users/roblourens","html_url":"https://github.com/roblourens","followers_url":"https://api.github.com/users/roblourens/followers","following_url":"https://api.github.com/users/roblourens/following{/other_user}","gists_url":"https://api.github.com/users/roblourens/gists{/gist_id}","starred_url":"https://api.github.com/users/roblourens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roblourens/subscriptions","organizations_url":"https://api.github.com/users/roblourens/orgs","repos_url":"https://api.github.com/users/roblourens/repos","events_url":"https://api.github.com/users/roblourens/events{/privacy}","received_events_url":"https://api.github.com/users/roblourens/received_events","type":"User","site_admin":false},"body":"Yeah, I would be ok with initializing it after the class declaration.","created_at":"2017-11-22T03:09:07Z","updated_at":"2017-11-22T03:09:07Z","html_url":"https://github.com/Microsoft/tolerant-php-parser/pull/211#discussion_r152459535","pull_request_url":"https://api.github.com/repos/Microsoft/tolerant-php-parser/pulls/211","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/Microsoft/tolerant-php-parser/pulls/comments/152459535"},"html":{"href":"https://github.com/Microsoft/tolerant-php-parser/pull/211#discussion_r152459535"},"pull_request":{"href":"https://api.github.com/repos/Microsoft/tolerant-php-parser/pulls/211"}},"in_reply_to_id":152373724},"pull_request":{"url":"https://api.github.com/repos/Microsoft/tolerant-php-parser/pulls/211","id":153947674,"html_url":"https://github.com/Microsoft/tolerant-php-parser/pull/211","diff_url":"https://github.com/Microsoft/tolerant-php-parser/pull/211.diff","patch_url":"https://github.com/Microsoft/tolerant-php-parser/pull/211.patch","issue_url":"https://api.github.com/repos/Microsoft/tolerant-php-parser/issues/211","number":211,"state":"open","locked":false,"title":"Optimize getDiagnostics for speed","user":{"login":"TysonAndre","id":1904430,"avatar_url":"https://avatars2.githubusercontent.com/u/1904430?v=4","gravatar_id":"","url":"https://api.github.com/users/TysonAndre","html_url":"https://github.com/TysonAndre","followers_url":"https://api.github.com/users/TysonAndre/followers","following_url":"https://api.github.com/users/TysonAndre/following{/other_user}","gists_url":"https://api.github.com/users/TysonAndre/gists{/gist_id}","starred_url":"https://api.github.com/users/TysonAndre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TysonAndre/subscriptions","organizations_url":"https://api.github.com/users/TysonAndre/orgs","repos_url":"https://api.github.com/users/TysonAndre/repos","events_url":"https://api.github.com/users/TysonAndre/events{/privacy}","received_events_url":"https://api.github.com/users/TysonAndre/received_events","type":"User","site_admin":false},"body":"Add a simple benchmarking script\r\n\r\nExtreme optimization, sacrificing code style in some areas.\r\n\r\n- This is meant for discussion, since the project is\r\n  in the optimization phase. Avoiding nested generators did help performance.\r\n\r\nThis commit reduces the time needed to getDiagnostics\r\nfrom 0.013 to 0.007 seconds. (On php 7.2.0RC5 with opcache enabled for CLI. Sample file was src/Token.php)\r\n\r\n```\r\nAverage time to generate diagnostics (before): 0.013...\r\nAverage time to generate diagnostics (after):  0.006921\r\ntime to parse (Without diagnostics):           0.036374\r\n```\r\n\r\n(E.g. getDiagnostics previously took 36% of the time compared to generating an\r\nAST, and now it takes 19% of that time.)","created_at":"2017-11-21T16:59:40Z","updated_at":"2017-11-22T03:09:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d4e39c8d4cd230a21be97ddbef5eea8cda10276c","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/Microsoft/tolerant-php-parser/pulls/211/commits","review_comments_url":"https://api.github.com/repos/Microsoft/tolerant-php-parser/pulls/211/comments","review_comment_url":"https://api.github.com/repos/Microsoft/tolerant-php-parser/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Microsoft/tolerant-php-parser/issues/211/comments","statuses_url":"https://api.github.com/repos/Microsoft/tolerant-php-parser/statuses/873cfca9eb8cb6c209a2c499f24f433fdef0c697","head":{"label":"TysonAndre:optimize-getDiagnostics-v2","ref":"optimize-getDiagnostics-v2","sha":"873cfca9eb8cb6c209a2c499f24f433fdef0c697","user":{"login":"TysonAndre","id":1904430,"avatar_url":"https://avatars2.githubusercontent.com/u/1904430?v=4","gravatar_id":"","url":"https://api.github.com/users/TysonAndre","html_url":"https://github.com/TysonAndre","followers_url":"https://api.github.com/users/TysonAndre/followers","following_url":"https://api.github.com/users/TysonAndre/following{/other_user}","gists_url":"https://api.github.com/users/TysonAndre/gists{/gist_id}","starred_url":"https://api.github.com/users/TysonAndre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TysonAndre/subscriptions","organizations_url":"https://api.github.com/users/TysonAndre/orgs","repos_url":"https://api.github.com/users/TysonAndre/repos","events_url":"https://api.github.com/users/TysonAndre/events{/privacy}","received_events_url":"https://api.github.com/users/TysonAndre/received_events","type":"User","site_admin":false},"repo":{"id":83236023,"name":"tolerant-php-parser","full_name":"TysonAndre/tolerant-php-parser","owner":{"login":"TysonAndre","id":1904430,"avatar_url":"https://avatars2.githubusercontent.com/u/1904430?v=4","gravatar_id":"","url":"https://api.github.com/users/TysonAndre","html_url":"https://github.com/TysonAndre","followers_url":"https://api.github.com/users/TysonAndre/followers","following_url":"https://api.github.com/users/TysonAndre/following{/other_user}","gists_url":"https://api.github.com/users/TysonAndre/gists{/gist_id}","starred_url":"https://api.github.com/users/TysonAndre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TysonAndre/subscriptions","organizations_url":"https://api.github.com/users/TysonAndre/orgs","repos_url":"https://api.github.com/users/TysonAndre/repos","events_url":"https://api.github.com/users/TysonAndre/events{/privacy}","received_events_url":"https://api.github.com/users/TysonAndre/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/TysonAndre/tolerant-php-parser","description":"An early-stage PHP parser designed for IDE usage scenarios.","fork":true,"url":"https://api.github.com/repos/TysonAndre/tolerant-php-parser","forks_url":"https://api.github.com/repos/TysonAndre/tolerant-php-parser/forks","keys_url":"https://api.github.com/repos/TysonAndre/tolerant-php-parser/keys{/key_id}","collaborators_url":"https://api.github.com/repos/TysonAndre/tolerant-php-parser/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/TysonAndre/tolerant-php-parser/teams","hooks_url":"https://api.github.com/repos/TysonAndre/tolerant-php-parser/hooks","issue_events_url":"https://api.github.com/repos/TysonAndre/tolerant-php-parser/issues/events{/number}","events_url":"https://api.github.com/repos/TysonAndre/tolerant-php-parser/events","assignees_url":"https://api.github.com/repos/TysonAndre/tolerant-php-parser/assignees{/user}","branches_url":"https://api.github.com/repos/TysonAndre/tolerant-php-parser/branches{/branch}","tags_url":"https://api.github.com/repos/TysonAndre/tolerant-php-parser/tags","blobs_url":"https://api.github.com/repos/TysonAndre/tolerant-php-parser/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/TysonAndre/tolerant-php-parser/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/TysonAndre/tolerant-php-parser/git/refs{/sha}","trees_url":"https://api.github.com/repos/TysonAndre/tolerant-php-parser/git/trees{/sha}","statuses_url":"https://api.github.com/repos/TysonAndre/tolerant-php-parser/statuses/{sha}","languages_url":"https://api.github.com/repos/TysonAndre/tolerant-php-parser/languages","stargazers_url":"https://api.github.com/repos/TysonAndre/tolerant-php-parser/stargazers","contributors_url":"https://api.github.com/repos/TysonAndre/tolerant-php-parser/contributors","subscribers_url":"https://api.github.com/repos/TysonAndre/tolerant-php-parser/subscribers","subscription_url":"https://api.github.com/repos/TysonAndre/tolerant-php-parser/subscription","commits_url":"https://api.github.com/repos/TysonAndre/tolerant-php-parser/commits{/sha}","git_commits_url":"https://api.github.com/repos/TysonAndre/tolerant-php-parser/git/commits{/sha}","comments_url":"https://api.github.com/repos/TysonAndre/tolerant-php-parser/comments{/number}","issue_comment_url":"https://api.github.com/repos/TysonAndre/tolerant-php-parser/issues/comments{/number}","contents_url":"https://api.github.com/repos/TysonAndre/tolerant-php-parser/contents/{+path}","compare_url":"https://api.github.com/repos/TysonAndre/tolerant-php-parser/compare/{base}...{head}","merges_url":"https://api.github.com/repos/TysonAndre/tolerant-php-parser/merges","archive_url":"https://api.github.com/repos/TysonAndre/tolerant-php-parser/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/TysonAndre/tolerant-php-parser/downloads","issues_url":"https://api.github.com/repos/TysonAndre/tolerant-php-parser/issues{/number}","pulls_url":"https://api.github.com/repos/TysonAndre/tolerant-php-parser/pulls{/number}","milestones_url":"https://api.github.com/repos/TysonAndre/tolerant-php-parser/milestones{/number}","notifications_url":"https://api.github.com/repos/TysonAndre/tolerant-php-parser/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/TysonAndre/tolerant-php-parser/labels{/name}","releases_url":"https://api.github.com/repos/TysonAndre/tolerant-php-parser/releases{/id}","deployments_url":"https://api.github.com/repos/TysonAndre/tolerant-php-parser/deployments","created_at":"2017-02-26T19:51:34Z","updated_at":"2017-09-21T20:15:53Z","pushed_at":"2017-11-21T16:58:58Z","git_url":"git://github.com/TysonAndre/tolerant-php-parser.git","ssh_url":"git@github.com:TysonAndre/tolerant-php-parser.git","clone_url":"https://github.com/TysonAndre/tolerant-php-parser.git","svn_url":"https://github.com/TysonAndre/tolerant-php-parser","homepage":"","size":3435,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"Microsoft:master","ref":"master","sha":"10e901a6086826376c6256954dc8903ef0ec6c9e","user":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars2.githubusercontent.com/u/6154722?v=4","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"repo":{"id":77562307,"name":"tolerant-php-parser","full_name":"Microsoft/tolerant-php-parser","owner":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars2.githubusercontent.com/u/6154722?v=4","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Microsoft/tolerant-php-parser","description":"An early-stage PHP parser designed for IDE usage scenarios.","fork":false,"url":"https://api.github.com/repos/Microsoft/tolerant-php-parser","forks_url":"https://api.github.com/repos/Microsoft/tolerant-php-parser/forks","keys_url":"https://api.github.com/repos/Microsoft/tolerant-php-parser/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Microsoft/tolerant-php-parser/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Microsoft/tolerant-php-parser/teams","hooks_url":"https://api.github.com/repos/Microsoft/tolerant-php-parser/hooks","issue_events_url":"https://api.github.com/repos/Microsoft/tolerant-php-parser/issues/events{/number}","events_url":"https://api.github.com/repos/Microsoft/tolerant-php-parser/events","assignees_url":"https://api.github.com/repos/Microsoft/tolerant-php-parser/assignees{/user}","branches_url":"https://api.github.com/repos/Microsoft/tolerant-php-parser/branches{/branch}","tags_url":"https://api.github.com/repos/Microsoft/tolerant-php-parser/tags","blobs_url":"https://api.github.com/repos/Microsoft/tolerant-php-parser/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Microsoft/tolerant-php-parser/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Microsoft/tolerant-php-parser/git/refs{/sha}","trees_url":"https://api.github.com/repos/Microsoft/tolerant-php-parser/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Microsoft/tolerant-php-parser/statuses/{sha}","languages_url":"https://api.github.com/repos/Microsoft/tolerant-php-parser/languages","stargazers_url":"https://api.github.com/repos/Microsoft/tolerant-php-parser/stargazers","contributors_url":"https://api.github.com/repos/Microsoft/tolerant-php-parser/contributors","subscribers_url":"https://api.github.com/repos/Microsoft/tolerant-php-parser/subscribers","subscription_url":"https://api.github.com/repos/Microsoft/tolerant-php-parser/subscription","commits_url":"https://api.github.com/repos/Microsoft/tolerant-php-parser/commits{/sha}","git_commits_url":"https://api.github.com/repos/Microsoft/tolerant-php-parser/git/commits{/sha}","comments_url":"https://api.github.com/repos/Microsoft/tolerant-php-parser/comments{/number}","issue_comment_url":"https://api.github.com/repos/Microsoft/tolerant-php-parser/issues/comments{/number}","contents_url":"https://api.github.com/repos/Microsoft/tolerant-php-parser/contents/{+path}","compare_url":"https://api.github.com/repos/Microsoft/tolerant-php-parser/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Microsoft/tolerant-php-parser/merges","archive_url":"https://api.github.com/repos/Microsoft/tolerant-php-parser/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Microsoft/tolerant-php-parser/downloads","issues_url":"https://api.github.com/repos/Microsoft/tolerant-php-parser/issues{/number}","pulls_url":"https://api.github.com/repos/Microsoft/tolerant-php-parser/pulls{/number}","milestones_url":"https://api.github.com/repos/Microsoft/tolerant-php-parser/milestones{/number}","notifications_url":"https://api.github.com/repos/Microsoft/tolerant-php-parser/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Microsoft/tolerant-php-parser/labels{/name}","releases_url":"https://api.github.com/repos/Microsoft/tolerant-php-parser/releases{/id}","deployments_url":"https://api.github.com/repos/Microsoft/tolerant-php-parser/deployments","created_at":"2016-12-28T21:26:25Z","updated_at":"2017-11-21T06:11:24Z","pushed_at":"2017-11-21T16:59:40Z","git_url":"git://github.com/Microsoft/tolerant-php-parser.git","ssh_url":"git@github.com:Microsoft/tolerant-php-parser.git","clone_url":"https://github.com/Microsoft/tolerant-php-parser.git","svn_url":"https://github.com/Microsoft/tolerant-php-parser","homepage":"","size":3425,"stargazers_count":468,"watchers_count":468,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":34,"mirror_url":null,"archived":false,"open_issues_count":56,"forks":34,"open_issues":56,"watchers":468,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Microsoft/tolerant-php-parser/pulls/211"},"html":{"href":"https://github.com/Microsoft/tolerant-php-parser/pull/211"},"issue":{"href":"https://api.github.com/repos/Microsoft/tolerant-php-parser/issues/211"},"comments":{"href":"https://api.github.com/repos/Microsoft/tolerant-php-parser/issues/211/comments"},"review_comments":{"href":"https://api.github.com/repos/Microsoft/tolerant-php-parser/pulls/211/comments"},"review_comment":{"href":"https://api.github.com/repos/Microsoft/tolerant-php-parser/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Microsoft/tolerant-php-parser/pulls/211/commits"},"statuses":{"href":"https://api.github.com/repos/Microsoft/tolerant-php-parser/statuses/873cfca9eb8cb6c209a2c499f24f433fdef0c697"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"roblourens"}}