{"action":"created","comment":{"url":"https://api.github.com/repos/aspnet/Razor/pulls/comments/170631127","pull_request_review_id":99343760,"id":170631127,"diff_hunk":"@@ -0,0 +1,238 @@\n+﻿// Copyright (c) .NET Foundation. All rights reserved.\n+// 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.Diagnostics;\n+\n+namespace Microsoft.AspNetCore.Razor.Tools\n+{\n+    /// <summary>\n+    /// Cache with a fixed size that evicts the least recently used members.\n+    /// Thread-safe.\n+    /// This was taken from https://github.com/dotnet/roslyn/blob/749c0ec135d7d080658dc1aa794d15229c3d10d2/src/Compilers/Core/Portable/InternalUtilities/ConcurrentLruCache.cs.\n+    /// </summary>\n+    internal class ConcurrentLruCache<K, V>\n+    {\n+        private readonly int _capacity;\n+\n+        private struct CacheValue\n+        {\n+            public V Value;\n+            public LinkedListNode<K> Node;\n+        }\n+\n+        private readonly Dictionary<K, CacheValue> _cache;\n+        private readonly LinkedList<K> _nodeList;\n+        // This is a naive course-grained lock, it can probably be optimized\n+        private readonly object _lockObject = new object();\n+\n+        public ConcurrentLruCache(int capacity)\n+        {\n+            if (capacity <= 0)\n+            {\n+                throw new ArgumentOutOfRangeException(nameof(capacity));\n+            }\n+            _capacity = capacity;\n+            _cache = new Dictionary<K, CacheValue>(capacity);\n+            _nodeList = new LinkedList<K>();\n+        }\n+\n+        /// <summary>\n+        /// Create cache from an array. The cache capacity will be the size\n+        /// of the array. All elements of the array will be added to the \n+        /// cache. If any duplicate keys are found in the array a\n+        /// <see cref=\"ArgumentException\"/> will be thrown.\n+        /// </summary>\n+        public ConcurrentLruCache(KeyValuePair<K, V>[] array)\n+            : this(array.Length)\n+        {\n+            foreach (var kvp in array)\n+            {\n+                this.UnsafeAdd(kvp.Key, kvp.Value, true);","path":"src/Microsoft.AspNetCore.Razor.Tools/ConcurrentLruCache.cs","position":52,"original_position":52,"commit_id":"be8fd55e1dd0aa05246f9a1be31a85dd273df0ce","original_commit_id":"be8fd55e1dd0aa05246f9a1be31a85dd273df0ce","user":{"login":"pranavkm","id":174281,"avatar_url":"https://avatars2.githubusercontent.com/u/174281?v=4","gravatar_id":"","url":"https://api.github.com/users/pranavkm","html_url":"https://github.com/pranavkm","followers_url":"https://api.github.com/users/pranavkm/followers","following_url":"https://api.github.com/users/pranavkm/following{/other_user}","gists_url":"https://api.github.com/users/pranavkm/gists{/gist_id}","starred_url":"https://api.github.com/users/pranavkm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pranavkm/subscriptions","organizations_url":"https://api.github.com/users/pranavkm/orgs","repos_url":"https://api.github.com/users/pranavkm/repos","events_url":"https://api.github.com/users/pranavkm/events{/privacy}","received_events_url":"https://api.github.com/users/pranavkm/received_events","type":"User","site_admin":false},"body":"Remove `this.`","created_at":"2018-02-26T15:36:06Z","updated_at":"2018-02-26T15:49:53Z","html_url":"https://github.com/aspnet/Razor/pull/2103#discussion_r170631127","pull_request_url":"https://api.github.com/repos/aspnet/Razor/pulls/2103","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/aspnet/Razor/pulls/comments/170631127"},"html":{"href":"https://github.com/aspnet/Razor/pull/2103#discussion_r170631127"},"pull_request":{"href":"https://api.github.com/repos/aspnet/Razor/pulls/2103"}}},"pull_request":{"url":"https://api.github.com/repos/aspnet/Razor/pulls/2103","id":170894182,"html_url":"https://github.com/aspnet/Razor/pull/2103","diff_url":"https://github.com/aspnet/Razor/pull/2103.diff","patch_url":"https://github.com/aspnet/Razor/pull/2103.patch","issue_url":"https://api.github.com/repos/aspnet/Razor/issues/2103","number":2103,"state":"open","locked":false,"title":"[Design] Perf: Cache assembly references in build server DiscoverCommand","user":{"login":"ajaybhargavb","id":1579269,"avatar_url":"https://avatars0.githubusercontent.com/u/1579269?v=4","gravatar_id":"","url":"https://api.github.com/users/ajaybhargavb","html_url":"https://github.com/ajaybhargavb","followers_url":"https://api.github.com/users/ajaybhargavb/followers","following_url":"https://api.github.com/users/ajaybhargavb/following{/other_user}","gists_url":"https://api.github.com/users/ajaybhargavb/gists{/gist_id}","starred_url":"https://api.github.com/users/ajaybhargavb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajaybhargavb/subscriptions","organizations_url":"https://api.github.com/users/ajaybhargavb/orgs","repos_url":"https://api.github.com/users/ajaybhargavb/repos","events_url":"https://api.github.com/users/ajaybhargavb/events{/privacy}","received_events_url":"https://api.github.com/users/ajaybhargavb/received_events","type":"User","site_admin":false},"body":"https://github.com/aspnet/Razor/issues/2111\r\nThis is an effort to reduce the perf impact of `MetadataReference.CreateFromFile()`. This is mostly inspired from Roslyn.\r\n\r\nBefore:\r\n![image](https://user-images.githubusercontent.com/1579269/36569731-c71dd862-17e3-11e8-8766-74e6caa571ff.png)\r\n\r\n\r\nAfter:\r\n![image](https://user-images.githubusercontent.com/1579269/36569755-df63fc62-17e3-11e8-9f06-e93fbda5005f.png)\r\n\r\n\r\n","created_at":"2018-02-22T23:21:02Z","updated_at":"2018-02-26T15:49:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f22e43cf43417508483cba553b4028413c2d93af","assignee":{"login":"rynowak","id":1430011,"avatar_url":"https://avatars1.githubusercontent.com/u/1430011?v=4","gravatar_id":"","url":"https://api.github.com/users/rynowak","html_url":"https://github.com/rynowak","followers_url":"https://api.github.com/users/rynowak/followers","following_url":"https://api.github.com/users/rynowak/following{/other_user}","gists_url":"https://api.github.com/users/rynowak/gists{/gist_id}","starred_url":"https://api.github.com/users/rynowak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rynowak/subscriptions","organizations_url":"https://api.github.com/users/rynowak/orgs","repos_url":"https://api.github.com/users/rynowak/repos","events_url":"https://api.github.com/users/rynowak/events{/privacy}","received_events_url":"https://api.github.com/users/rynowak/received_events","type":"User","site_admin":false},"assignees":[{"login":"rynowak","id":1430011,"avatar_url":"https://avatars1.githubusercontent.com/u/1430011?v=4","gravatar_id":"","url":"https://api.github.com/users/rynowak","html_url":"https://github.com/rynowak","followers_url":"https://api.github.com/users/rynowak/followers","following_url":"https://api.github.com/users/rynowak/following{/other_user}","gists_url":"https://api.github.com/users/rynowak/gists{/gist_id}","starred_url":"https://api.github.com/users/rynowak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rynowak/subscriptions","organizations_url":"https://api.github.com/users/rynowak/orgs","repos_url":"https://api.github.com/users/rynowak/repos","events_url":"https://api.github.com/users/rynowak/events{/privacy}","received_events_url":"https://api.github.com/users/rynowak/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/aspnet/Razor/pulls/2103/commits","review_comments_url":"https://api.github.com/repos/aspnet/Razor/pulls/2103/comments","review_comment_url":"https://api.github.com/repos/aspnet/Razor/pulls/comments{/number}","comments_url":"https://api.github.com/repos/aspnet/Razor/issues/2103/comments","statuses_url":"https://api.github.com/repos/aspnet/Razor/statuses/be8fd55e1dd0aa05246f9a1be31a85dd273df0ce","head":{"label":"aspnet:ajbaaska/metadata-cache","ref":"ajbaaska/metadata-cache","sha":"be8fd55e1dd0aa05246f9a1be31a85dd273df0ce","user":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars3.githubusercontent.com/u/6476660?v=4","gravatar_id":"","url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"repo":{"id":15835991,"name":"Razor","full_name":"aspnet/Razor","owner":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars3.githubusercontent.com/u/6476660?v=4","gravatar_id":"","url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/aspnet/Razor","description":"Parser and code generator for CSHTML files used in view pages for MVC web apps.","fork":false,"url":"https://api.github.com/repos/aspnet/Razor","forks_url":"https://api.github.com/repos/aspnet/Razor/forks","keys_url":"https://api.github.com/repos/aspnet/Razor/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aspnet/Razor/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aspnet/Razor/teams","hooks_url":"https://api.github.com/repos/aspnet/Razor/hooks","issue_events_url":"https://api.github.com/repos/aspnet/Razor/issues/events{/number}","events_url":"https://api.github.com/repos/aspnet/Razor/events","assignees_url":"https://api.github.com/repos/aspnet/Razor/assignees{/user}","branches_url":"https://api.github.com/repos/aspnet/Razor/branches{/branch}","tags_url":"https://api.github.com/repos/aspnet/Razor/tags","blobs_url":"https://api.github.com/repos/aspnet/Razor/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aspnet/Razor/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aspnet/Razor/git/refs{/sha}","trees_url":"https://api.github.com/repos/aspnet/Razor/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aspnet/Razor/statuses/{sha}","languages_url":"https://api.github.com/repos/aspnet/Razor/languages","stargazers_url":"https://api.github.com/repos/aspnet/Razor/stargazers","contributors_url":"https://api.github.com/repos/aspnet/Razor/contributors","subscribers_url":"https://api.github.com/repos/aspnet/Razor/subscribers","subscription_url":"https://api.github.com/repos/aspnet/Razor/subscription","commits_url":"https://api.github.com/repos/aspnet/Razor/commits{/sha}","git_commits_url":"https://api.github.com/repos/aspnet/Razor/git/commits{/sha}","comments_url":"https://api.github.com/repos/aspnet/Razor/comments{/number}","issue_comment_url":"https://api.github.com/repos/aspnet/Razor/issues/comments{/number}","contents_url":"https://api.github.com/repos/aspnet/Razor/contents/{+path}","compare_url":"https://api.github.com/repos/aspnet/Razor/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aspnet/Razor/merges","archive_url":"https://api.github.com/repos/aspnet/Razor/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aspnet/Razor/downloads","issues_url":"https://api.github.com/repos/aspnet/Razor/issues{/number}","pulls_url":"https://api.github.com/repos/aspnet/Razor/pulls{/number}","milestones_url":"https://api.github.com/repos/aspnet/Razor/milestones{/number}","notifications_url":"https://api.github.com/repos/aspnet/Razor/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aspnet/Razor/labels{/name}","releases_url":"https://api.github.com/repos/aspnet/Razor/releases{/id}","deployments_url":"https://api.github.com/repos/aspnet/Razor/deployments","created_at":"2014-01-12T03:52:46Z","updated_at":"2018-02-26T04:20:01Z","pushed_at":"2018-02-24T21:56:09Z","git_url":"git://github.com/aspnet/Razor.git","ssh_url":"git@github.com:aspnet/Razor.git","clone_url":"https://github.com/aspnet/Razor.git","svn_url":"https://github.com/aspnet/Razor","homepage":"","size":11691,"stargazers_count":755,"watchers_count":755,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":207,"mirror_url":null,"archived":false,"open_issues_count":137,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":207,"open_issues":137,"watchers":755,"default_branch":"dev"}},"base":{"label":"aspnet:dev","ref":"dev","sha":"60e5818884470c923bcac4271dffb369c50aa89d","user":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars3.githubusercontent.com/u/6476660?v=4","gravatar_id":"","url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"repo":{"id":15835991,"name":"Razor","full_name":"aspnet/Razor","owner":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars3.githubusercontent.com/u/6476660?v=4","gravatar_id":"","url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/aspnet/Razor","description":"Parser and code generator for CSHTML files used in view pages for MVC web apps.","fork":false,"url":"https://api.github.com/repos/aspnet/Razor","forks_url":"https://api.github.com/repos/aspnet/Razor/forks","keys_url":"https://api.github.com/repos/aspnet/Razor/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aspnet/Razor/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aspnet/Razor/teams","hooks_url":"https://api.github.com/repos/aspnet/Razor/hooks","issue_events_url":"https://api.github.com/repos/aspnet/Razor/issues/events{/number}","events_url":"https://api.github.com/repos/aspnet/Razor/events","assignees_url":"https://api.github.com/repos/aspnet/Razor/assignees{/user}","branches_url":"https://api.github.com/repos/aspnet/Razor/branches{/branch}","tags_url":"https://api.github.com/repos/aspnet/Razor/tags","blobs_url":"https://api.github.com/repos/aspnet/Razor/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aspnet/Razor/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aspnet/Razor/git/refs{/sha}","trees_url":"https://api.github.com/repos/aspnet/Razor/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aspnet/Razor/statuses/{sha}","languages_url":"https://api.github.com/repos/aspnet/Razor/languages","stargazers_url":"https://api.github.com/repos/aspnet/Razor/stargazers","contributors_url":"https://api.github.com/repos/aspnet/Razor/contributors","subscribers_url":"https://api.github.com/repos/aspnet/Razor/subscribers","subscription_url":"https://api.github.com/repos/aspnet/Razor/subscription","commits_url":"https://api.github.com/repos/aspnet/Razor/commits{/sha}","git_commits_url":"https://api.github.com/repos/aspnet/Razor/git/commits{/sha}","comments_url":"https://api.github.com/repos/aspnet/Razor/comments{/number}","issue_comment_url":"https://api.github.com/repos/aspnet/Razor/issues/comments{/number}","contents_url":"https://api.github.com/repos/aspnet/Razor/contents/{+path}","compare_url":"https://api.github.com/repos/aspnet/Razor/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aspnet/Razor/merges","archive_url":"https://api.github.com/repos/aspnet/Razor/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aspnet/Razor/downloads","issues_url":"https://api.github.com/repos/aspnet/Razor/issues{/number}","pulls_url":"https://api.github.com/repos/aspnet/Razor/pulls{/number}","milestones_url":"https://api.github.com/repos/aspnet/Razor/milestones{/number}","notifications_url":"https://api.github.com/repos/aspnet/Razor/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aspnet/Razor/labels{/name}","releases_url":"https://api.github.com/repos/aspnet/Razor/releases{/id}","deployments_url":"https://api.github.com/repos/aspnet/Razor/deployments","created_at":"2014-01-12T03:52:46Z","updated_at":"2018-02-26T04:20:01Z","pushed_at":"2018-02-24T21:56:09Z","git_url":"git://github.com/aspnet/Razor.git","ssh_url":"git@github.com:aspnet/Razor.git","clone_url":"https://github.com/aspnet/Razor.git","svn_url":"https://github.com/aspnet/Razor","homepage":"","size":11691,"stargazers_count":755,"watchers_count":755,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":207,"mirror_url":null,"archived":false,"open_issues_count":137,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":207,"open_issues":137,"watchers":755,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/aspnet/Razor/pulls/2103"},"html":{"href":"https://github.com/aspnet/Razor/pull/2103"},"issue":{"href":"https://api.github.com/repos/aspnet/Razor/issues/2103"},"comments":{"href":"https://api.github.com/repos/aspnet/Razor/issues/2103/comments"},"review_comments":{"href":"https://api.github.com/repos/aspnet/Razor/pulls/2103/comments"},"review_comment":{"href":"https://api.github.com/repos/aspnet/Razor/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/aspnet/Razor/pulls/2103/commits"},"statuses":{"href":"https://api.github.com/repos/aspnet/Razor/statuses/be8fd55e1dd0aa05246f9a1be31a85dd273df0ce"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"pranavkm"}}