{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/roslyn/pulls/comments/75917381","id":75917381,"diff_hunk":"@@ -0,0 +1,146 @@\n+﻿// Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.\n+\n+using System;\n+using System.Collections.Generic;\n+using System.Collections.Immutable;\n+using System.Diagnostics;\n+using System.Reflection.Metadata;\n+using System.Reflection.Metadata.Ecma335;\n+using Roslyn.Utilities;\n+\n+namespace Microsoft.CodeAnalysis.FindSymbols\n+{\n+    internal partial class SymbolTreeInfo\n+    {\n+        /// <summary>\n+        /// Used to produce the simple-full-name components of a type from metadata.\n+        /// The name is 'simple' in that it does not contain things like backticks,\n+        /// generic arguments, or nested type + separators.  Instead just hte name\n+        /// of the type, any containing types, and the component parts of its namespace\n+        /// are added.  For example, for the type \"X.Y.O`1.I`2, we will produce [X, Y, O, I]\n+        /// \n+        /// </summary>\n+        private class BaseNameProvider : ISignatureTypeProvider<object>","path":"src/Workspaces/Core/Portable/FindSymbols/SymbolTree/SymbolTreeInfo.BaseNameProvider.cs","position":23,"original_position":23,"commit_id":"07703e3c27c90dd941c8d51a5f31455f293d9eb7","original_commit_id":"77325a9d597d268b2b4f9f8dde0ffc9d4f93d84c","user":{"login":"CyrusNajmabadi","id":4564579,"avatar_url":"https://avatars.githubusercontent.com/u/4564579?v=3","gravatar_id":"","url":"https://api.github.com/users/CyrusNajmabadi","html_url":"https://github.com/CyrusNajmabadi","followers_url":"https://api.github.com/users/CyrusNajmabadi/followers","following_url":"https://api.github.com/users/CyrusNajmabadi/following{/other_user}","gists_url":"https://api.github.com/users/CyrusNajmabadi/gists{/gist_id}","starred_url":"https://api.github.com/users/CyrusNajmabadi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CyrusNajmabadi/subscriptions","organizations_url":"https://api.github.com/users/CyrusNajmabadi/orgs","repos_url":"https://api.github.com/users/CyrusNajmabadi/repos","events_url":"https://api.github.com/users/CyrusNajmabadi/events{/privacy}","received_events_url":"https://api.github.com/users/CyrusNajmabadi/received_events","type":"User","site_admin":false},"body":"Good idea.  @tmat let me know if you think i've implemented this properly, of if there's an easier way to do things.  I did take a look inside SignatureDecoder, and i think this is done correctly.\r\n\r\nEssently, given a TypeSpecification for a basetype/interface i want to get the simple name parts of the name.  i.e. for ```NS1.NS2.Outer<X,Y>.Inner<Whatever>``` i want to just get ```[NS1, NS2, Outer, Inner]```, for TypeDefs and TypeRefs this is simple.  For TypeSpecs it was definitely more involved.","created_at":"2016-08-23T17:51:39Z","updated_at":"2016-08-23T17:51:39Z","html_url":"https://github.com/dotnet/roslyn/pull/13266#discussion_r75917381","pull_request_url":"https://api.github.com/repos/dotnet/roslyn/pulls/13266","_links":{"self":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/comments/75917381"},"html":{"href":"https://github.com/dotnet/roslyn/pull/13266#discussion_r75917381"},"pull_request":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/13266"}}},"pull_request":{"url":"https://api.github.com/repos/dotnet/roslyn/pulls/13266","id":81922276,"html_url":"https://github.com/dotnet/roslyn/pull/13266","diff_url":"https://github.com/dotnet/roslyn/pull/13266.diff","patch_url":"https://github.com/dotnet/roslyn/pull/13266.patch","issue_url":"https://api.github.com/repos/dotnet/roslyn/issues/13266","number":13266,"state":"open","locked":false,"title":"Speed up SymbolFinder by store inheritance information in our metadata index.","user":{"login":"CyrusNajmabadi","id":4564579,"avatar_url":"https://avatars.githubusercontent.com/u/4564579?v=3","gravatar_id":"","url":"https://api.github.com/users/CyrusNajmabadi","html_url":"https://github.com/CyrusNajmabadi","followers_url":"https://api.github.com/users/CyrusNajmabadi/followers","following_url":"https://api.github.com/users/CyrusNajmabadi/following{/other_user}","gists_url":"https://api.github.com/users/CyrusNajmabadi/gists{/gist_id}","starred_url":"https://api.github.com/users/CyrusNajmabadi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CyrusNajmabadi/subscriptions","organizations_url":"https://api.github.com/users/CyrusNajmabadi/orgs","repos_url":"https://api.github.com/users/CyrusNajmabadi/repos","events_url":"https://api.github.com/users/CyrusNajmabadi/events{/privacy}","received_events_url":"https://api.github.com/users/CyrusNajmabadi/received_events","type":"User","site_admin":false},"body":"Previously if we needed to look for all implementations of a metadata type (like IDisposable) we would walk every metadata type in the project and ask it \"do you derive from IDisposable\".  This was expensive in many axes:\r\n\r\n1. We had to examine every metadata type.  That's linear in the number of symbols brought in by metadata references.\r\n2. We had to create a Roslyn symbol for every type.  \r\n3. We had to walk the inheritance chain of every type.\r\n\r\nObviously quite a lot of work.  Roslyn is quite fast with metadata, but it would still be nice to improve that a bit.    A while back we had a similar issue as well with Source symbols, and we improved things by adding information in our Source-symbol-index about inheritance information in the file (https://github.com/dotnet/roslyn/commit/cdd6ae211a20701fe72905204b96e7444b5dced0).  This inheritance info allowed us to drastically reduce the set of documents to search when looking for inherited types during a symbol finding operation.\r\n\r\nThis change introduces a similar concept for our metadata indices.  Now, when we build up our metadata index (the same index we use for Add-Using), we store a inheritance mapping that allows us to answer inheritance questions easily.  This inheritance maps between a type's simple name (like ```IDictionary```) and the fully qualified names of the types the derive from it (like ```System.Collections.Generic.Dictionary`2```).  Now, when we search for derived metadata types, we can quickly get these metadata names and ask the Roslyn compiler to just create symbols for them instead of every symbol in the assembly.\r\n\r\nPrior to making this change, if we needed to search for the derived types of IDisposable *just* in mscorlib, we would have to create and check around 5000 symbols.  After the change, that drops to only  225 symbols (a decrease of 95%).  And this is one of the most egregious examples as IDispoable has tons of derivations.  For most metadata types, we will go from 5000 symbols to a scant handful of symbols created.\r\n\r\n--\r\n\r\nAs an added bonus, because this is part of the SymbolTreeInfo index, it gets created automatically in the background and persisted to disk.  As such, once built up, it should improve lots of SymbolFinding scenarios if they hit metadata symbols.","created_at":"2016-08-19T03:39:57Z","updated_at":"2016-08-23T17:51:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dc84bf3388ef04bc53fc1df4638341860e33ef76","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/dotnet/roslyn/pulls/13266/commits","review_comments_url":"https://api.github.com/repos/dotnet/roslyn/pulls/13266/comments","review_comment_url":"https://api.github.com/repos/dotnet/roslyn/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnet/roslyn/issues/13266/comments","statuses_url":"https://api.github.com/repos/dotnet/roslyn/statuses/07703e3c27c90dd941c8d51a5f31455f293d9eb7","head":{"label":"CyrusNajmabadi:metadataInheritance","ref":"metadataInheritance","sha":"07703e3c27c90dd941c8d51a5f31455f293d9eb7","user":{"login":"CyrusNajmabadi","id":4564579,"avatar_url":"https://avatars.githubusercontent.com/u/4564579?v=3","gravatar_id":"","url":"https://api.github.com/users/CyrusNajmabadi","html_url":"https://github.com/CyrusNajmabadi","followers_url":"https://api.github.com/users/CyrusNajmabadi/followers","following_url":"https://api.github.com/users/CyrusNajmabadi/following{/other_user}","gists_url":"https://api.github.com/users/CyrusNajmabadi/gists{/gist_id}","starred_url":"https://api.github.com/users/CyrusNajmabadi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CyrusNajmabadi/subscriptions","organizations_url":"https://api.github.com/users/CyrusNajmabadi/orgs","repos_url":"https://api.github.com/users/CyrusNajmabadi/repos","events_url":"https://api.github.com/users/CyrusNajmabadi/events{/privacy}","received_events_url":"https://api.github.com/users/CyrusNajmabadi/received_events","type":"User","site_admin":false},"repo":{"id":30565155,"name":"roslyn","full_name":"CyrusNajmabadi/roslyn","owner":{"login":"CyrusNajmabadi","id":4564579,"avatar_url":"https://avatars.githubusercontent.com/u/4564579?v=3","gravatar_id":"","url":"https://api.github.com/users/CyrusNajmabadi","html_url":"https://github.com/CyrusNajmabadi","followers_url":"https://api.github.com/users/CyrusNajmabadi/followers","following_url":"https://api.github.com/users/CyrusNajmabadi/following{/other_user}","gists_url":"https://api.github.com/users/CyrusNajmabadi/gists{/gist_id}","starred_url":"https://api.github.com/users/CyrusNajmabadi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CyrusNajmabadi/subscriptions","organizations_url":"https://api.github.com/users/CyrusNajmabadi/orgs","repos_url":"https://api.github.com/users/CyrusNajmabadi/repos","events_url":"https://api.github.com/users/CyrusNajmabadi/events{/privacy}","received_events_url":"https://api.github.com/users/CyrusNajmabadi/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/CyrusNajmabadi/roslyn","description":"The .NET Compiler Platform (\"Roslyn\") provides open-source C# and Visual Basic compilers with rich code analysis APIs.","fork":true,"url":"https://api.github.com/repos/CyrusNajmabadi/roslyn","forks_url":"https://api.github.com/repos/CyrusNajmabadi/roslyn/forks","keys_url":"https://api.github.com/repos/CyrusNajmabadi/roslyn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CyrusNajmabadi/roslyn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CyrusNajmabadi/roslyn/teams","hooks_url":"https://api.github.com/repos/CyrusNajmabadi/roslyn/hooks","issue_events_url":"https://api.github.com/repos/CyrusNajmabadi/roslyn/issues/events{/number}","events_url":"https://api.github.com/repos/CyrusNajmabadi/roslyn/events","assignees_url":"https://api.github.com/repos/CyrusNajmabadi/roslyn/assignees{/user}","branches_url":"https://api.github.com/repos/CyrusNajmabadi/roslyn/branches{/branch}","tags_url":"https://api.github.com/repos/CyrusNajmabadi/roslyn/tags","blobs_url":"https://api.github.com/repos/CyrusNajmabadi/roslyn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CyrusNajmabadi/roslyn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CyrusNajmabadi/roslyn/git/refs{/sha}","trees_url":"https://api.github.com/repos/CyrusNajmabadi/roslyn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CyrusNajmabadi/roslyn/statuses/{sha}","languages_url":"https://api.github.com/repos/CyrusNajmabadi/roslyn/languages","stargazers_url":"https://api.github.com/repos/CyrusNajmabadi/roslyn/stargazers","contributors_url":"https://api.github.com/repos/CyrusNajmabadi/roslyn/contributors","subscribers_url":"https://api.github.com/repos/CyrusNajmabadi/roslyn/subscribers","subscription_url":"https://api.github.com/repos/CyrusNajmabadi/roslyn/subscription","commits_url":"https://api.github.com/repos/CyrusNajmabadi/roslyn/commits{/sha}","git_commits_url":"https://api.github.com/repos/CyrusNajmabadi/roslyn/git/commits{/sha}","comments_url":"https://api.github.com/repos/CyrusNajmabadi/roslyn/comments{/number}","issue_comment_url":"https://api.github.com/repos/CyrusNajmabadi/roslyn/issues/comments{/number}","contents_url":"https://api.github.com/repos/CyrusNajmabadi/roslyn/contents/{+path}","compare_url":"https://api.github.com/repos/CyrusNajmabadi/roslyn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CyrusNajmabadi/roslyn/merges","archive_url":"https://api.github.com/repos/CyrusNajmabadi/roslyn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CyrusNajmabadi/roslyn/downloads","issues_url":"https://api.github.com/repos/CyrusNajmabadi/roslyn/issues{/number}","pulls_url":"https://api.github.com/repos/CyrusNajmabadi/roslyn/pulls{/number}","milestones_url":"https://api.github.com/repos/CyrusNajmabadi/roslyn/milestones{/number}","notifications_url":"https://api.github.com/repos/CyrusNajmabadi/roslyn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CyrusNajmabadi/roslyn/labels{/name}","releases_url":"https://api.github.com/repos/CyrusNajmabadi/roslyn/releases{/id}","deployments_url":"https://api.github.com/repos/CyrusNajmabadi/roslyn/deployments","created_at":"2015-02-09T23:45:22Z","updated_at":"2016-01-11T20:46:56Z","pushed_at":"2016-08-23T17:48:22Z","git_url":"git://github.com/CyrusNajmabadi/roslyn.git","ssh_url":"git@github.com:CyrusNajmabadi/roslyn.git","clone_url":"https://github.com/CyrusNajmabadi/roslyn.git","svn_url":"https://github.com/CyrusNajmabadi/roslyn","homepage":"","size":168845,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dotnet:master","ref":"master","sha":"fa91734756fa5fffc8683d30c59c7fba3d08bbaf","user":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"repo":{"id":29078997,"name":"roslyn","full_name":"dotnet/roslyn","owner":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dotnet/roslyn","description":"The .NET Compiler Platform (\"Roslyn\") provides open-source C# and Visual Basic compilers with rich code analysis APIs.","fork":false,"url":"https://api.github.com/repos/dotnet/roslyn","forks_url":"https://api.github.com/repos/dotnet/roslyn/forks","keys_url":"https://api.github.com/repos/dotnet/roslyn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dotnet/roslyn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dotnet/roslyn/teams","hooks_url":"https://api.github.com/repos/dotnet/roslyn/hooks","issue_events_url":"https://api.github.com/repos/dotnet/roslyn/issues/events{/number}","events_url":"https://api.github.com/repos/dotnet/roslyn/events","assignees_url":"https://api.github.com/repos/dotnet/roslyn/assignees{/user}","branches_url":"https://api.github.com/repos/dotnet/roslyn/branches{/branch}","tags_url":"https://api.github.com/repos/dotnet/roslyn/tags","blobs_url":"https://api.github.com/repos/dotnet/roslyn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dotnet/roslyn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dotnet/roslyn/git/refs{/sha}","trees_url":"https://api.github.com/repos/dotnet/roslyn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dotnet/roslyn/statuses/{sha}","languages_url":"https://api.github.com/repos/dotnet/roslyn/languages","stargazers_url":"https://api.github.com/repos/dotnet/roslyn/stargazers","contributors_url":"https://api.github.com/repos/dotnet/roslyn/contributors","subscribers_url":"https://api.github.com/repos/dotnet/roslyn/subscribers","subscription_url":"https://api.github.com/repos/dotnet/roslyn/subscription","commits_url":"https://api.github.com/repos/dotnet/roslyn/commits{/sha}","git_commits_url":"https://api.github.com/repos/dotnet/roslyn/git/commits{/sha}","comments_url":"https://api.github.com/repos/dotnet/roslyn/comments{/number}","issue_comment_url":"https://api.github.com/repos/dotnet/roslyn/issues/comments{/number}","contents_url":"https://api.github.com/repos/dotnet/roslyn/contents/{+path}","compare_url":"https://api.github.com/repos/dotnet/roslyn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dotnet/roslyn/merges","archive_url":"https://api.github.com/repos/dotnet/roslyn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dotnet/roslyn/downloads","issues_url":"https://api.github.com/repos/dotnet/roslyn/issues{/number}","pulls_url":"https://api.github.com/repos/dotnet/roslyn/pulls{/number}","milestones_url":"https://api.github.com/repos/dotnet/roslyn/milestones{/number}","notifications_url":"https://api.github.com/repos/dotnet/roslyn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dotnet/roslyn/labels{/name}","releases_url":"https://api.github.com/repos/dotnet/roslyn/releases{/id}","deployments_url":"https://api.github.com/repos/dotnet/roslyn/deployments","created_at":"2015-01-11T02:39:03Z","updated_at":"2016-08-23T13:30:29Z","pushed_at":"2016-08-23T17:48:23Z","git_url":"git://github.com/dotnet/roslyn.git","ssh_url":"git@github.com:dotnet/roslyn.git","clone_url":"https://github.com/dotnet/roslyn.git","svn_url":"https://github.com/dotnet/roslyn","homepage":"","size":327004,"stargazers_count":6054,"watchers_count":6054,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1453,"mirror_url":null,"open_issues_count":3154,"forks":1453,"open_issues":3154,"watchers":6054,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/13266"},"html":{"href":"https://github.com/dotnet/roslyn/pull/13266"},"issue":{"href":"https://api.github.com/repos/dotnet/roslyn/issues/13266"},"comments":{"href":"https://api.github.com/repos/dotnet/roslyn/issues/13266/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/13266/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/13266/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/roslyn/statuses/07703e3c27c90dd941c8d51a5f31455f293d9eb7"}}}}
{"actor":{"display_login":"CyrusNajmabadi"}}