{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/corefx/pulls/comments/41625270","id":41625270,"diff_hunk":"@@ -0,0 +1,115 @@\n+﻿// Copyright (c) Microsoft. All rights reserved.\n+// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n+\n+using System.Threading;\n+\n+namespace System.IO.Compression.Internal\n+{\n+    /// <summary>\n+    /// Generic implementation of object pooling pattern with predefined pool size limit. The main\n+    /// purpose is that limited number of frequently used objects can be kept in the pool for\n+    /// further recycling.\n+    /// \n+    /// Notes: \n+    /// 1) it is not the goal to keep all returned objects. Pool is not meant for storage. If there\n+    ///    is no space in the pool, extra returned objects will be dropped.\n+    /// \n+    /// 2) it is implied that if object was obtained from a pool, the caller will return it back in\n+    ///    a relatively short time. Keeping checked out objects for long durations is ok, but \n+    ///    reduces usefulness of pooling. Just new up your own.\n+    /// \n+    /// Not returning objects to the pool in not detrimental to the pool's work, but is a bad practice. \n+    /// Rationale: \n+    ///    If there is no intent for reusing the object, do not use pool - just use \"new\". \n+    /// </summary>\n+    internal sealed class ObjectPool<T> where T : class\n+    {\n+        private struct Element\n+        {\n+            internal T Value;\n+        }\n+\n+        // storage for the pool objects.\n+        private readonly Element[] _items;\n+\n+        // factory is stored for the lifetime of the pool. We will call this only when pool needs to\n+        // expand. compared to \"new T()\", Func gives more flexibility to implementers and faster\n+        // than \"new T()\".\n+        private readonly Func<T> _factory;\n+\n+\n+        internal ObjectPool(Func<T> factory)\n+            : this(factory, Environment.ProcessorCount * 2)\n+        { }\n+\n+        internal ObjectPool(Func<T> factory, int size)\n+        {\n+            _factory = factory;\n+            _items = new Element[size];\n+        }\n+\n+        private T CreateInstance()\n+        {\n+            var inst = _factory();\n+            return inst;\n+        }\n+\n+        /// <summary>\n+        /// Produces an instance.\n+        /// </summary>\n+        /// <remarks>\n+        /// Search strategy is a simple linear probing which is chosen for it cache-friendliness.\n+        /// Note that Free will try to store recycled objects close to the start thus statistically \n+        /// reducing how far we will typically search.\n+        /// </remarks>\n+        internal T Allocate()\n+        {\n+            var items = _items;","path":"src/System.IO.Compression/src/System/IO/Compression/Internal/ObjectPool`1.cs","position":67,"original_position":67,"commit_id":"c6bed6692906d22b34eaf0e5a8ff90113fb30768","original_commit_id":"c6bed6692906d22b34eaf0e5a8ff90113fb30768","user":{"login":"redknightlois","id":1045411,"avatar_url":"https://avatars.githubusercontent.com/u/1045411?v=3","gravatar_id":"","url":"https://api.github.com/users/redknightlois","html_url":"https://github.com/redknightlois","followers_url":"https://api.github.com/users/redknightlois/followers","following_url":"https://api.github.com/users/redknightlois/following{/other_user}","gists_url":"https://api.github.com/users/redknightlois/gists{/gist_id}","starred_url":"https://api.github.com/users/redknightlois/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/redknightlois/subscriptions","organizations_url":"https://api.github.com/users/redknightlois/orgs","repos_url":"https://api.github.com/users/redknightlois/repos","events_url":"https://api.github.com/users/redknightlois/events{/privacy}","received_events_url":"https://api.github.com/users/redknightlois/received_events","type":"User","site_admin":false},"body":"@stephentoub I didn't get any response from either the ticket I opened to DocuSign and the email I sent to the DotNet Foundation that is specified in the email. Do you know who I could contact to be able to sign the CLA? Because it is not working, tried in Chrome and Edge, no luck. ","created_at":"2015-10-09T12:39:10Z","updated_at":"2015-10-09T12:39:10Z","html_url":"https://github.com/dotnet/corefx/pull/3702#discussion_r41625270","pull_request_url":"https://api.github.com/repos/dotnet/corefx/pulls/3702","_links":{"self":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/comments/41625270"},"html":{"href":"https://github.com/dotnet/corefx/pull/3702#discussion_r41625270"},"pull_request":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/3702"}}},"pull_request":{"url":"https://api.github.com/repos/dotnet/corefx/pulls/3702","id":47074657,"html_url":"https://github.com/dotnet/corefx/pull/3702","diff_url":"https://github.com/dotnet/corefx/pull/3702.diff","patch_url":"https://github.com/dotnet/corefx/pull/3702.patch","issue_url":"https://api.github.com/repos/dotnet/corefx/issues/3702","number":3702,"state":"open","locked":false,"title":"#1991 - ObjectPool approach","user":{"login":"redknightlois","id":1045411,"avatar_url":"https://avatars.githubusercontent.com/u/1045411?v=3","gravatar_id":"","url":"https://api.github.com/users/redknightlois","html_url":"https://github.com/redknightlois","followers_url":"https://api.github.com/users/redknightlois/followers","following_url":"https://api.github.com/users/redknightlois/following{/other_user}","gists_url":"https://api.github.com/users/redknightlois/gists{/gist_id}","starred_url":"https://api.github.com/users/redknightlois/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/redknightlois/subscriptions","organizations_url":"https://api.github.com/users/redknightlois/orgs","repos_url":"https://api.github.com/users/redknightlois/repos","events_url":"https://api.github.com/users/redknightlois/events{/privacy}","received_events_url":"https://api.github.com/users/redknightlois/received_events","type":"User","site_admin":false},"body":"Allow DefrateStream and OutputWindow to pool internal resources that causes stress allocation when DefrateStream is used in high throughput small data packages. Those commonly happen in web servers which accept gzipped incoming connections and must respond accordingly. DefrateStream will allocate for reuse up to 256Kb of memory (or up to 32 concurrent streams without allocations) and will apply both to ZLib and Managed versions. On the managed implementation (InfrateManaged), there will exist a reservation of up to 512Kb of memory (or up to 16 concurrent compression streams without allocations). The rationale is that on the web server scenario messages are paired, one incoming and one outgoing, therefore there are half as many InfrateManaged than total DefrateStreams.\r\n\r\nReservations happen lazily, therefore in low throughput scenarios the probability of allocating the whole 768Kb is pretty low.\r\n\r\nFix: #1991","created_at":"2015-10-07T20:02:18Z","updated_at":"2015-10-09T12:39:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8624bc1a7f5cd517f37fdcb889153c0e8e5bdf6f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dotnet/corefx/pulls/3702/commits","review_comments_url":"https://api.github.com/repos/dotnet/corefx/pulls/3702/comments","review_comment_url":"https://api.github.com/repos/dotnet/corefx/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnet/corefx/issues/3702/comments","statuses_url":"https://api.github.com/repos/dotnet/corefx/statuses/c6bed6692906d22b34eaf0e5a8ff90113fb30768","head":{"label":"redknightlois:1991-object-pool","ref":"1991-object-pool","sha":"c6bed6692906d22b34eaf0e5a8ff90113fb30768","user":{"login":"redknightlois","id":1045411,"avatar_url":"https://avatars.githubusercontent.com/u/1045411?v=3","gravatar_id":"","url":"https://api.github.com/users/redknightlois","html_url":"https://github.com/redknightlois","followers_url":"https://api.github.com/users/redknightlois/followers","following_url":"https://api.github.com/users/redknightlois/following{/other_user}","gists_url":"https://api.github.com/users/redknightlois/gists{/gist_id}","starred_url":"https://api.github.com/users/redknightlois/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/redknightlois/subscriptions","organizations_url":"https://api.github.com/users/redknightlois/orgs","repos_url":"https://api.github.com/users/redknightlois/repos","events_url":"https://api.github.com/users/redknightlois/events{/privacy}","received_events_url":"https://api.github.com/users/redknightlois/received_events","type":"User","site_admin":false},"repo":{"id":43822641,"name":"corefx","full_name":"redknightlois/corefx","owner":{"login":"redknightlois","id":1045411,"avatar_url":"https://avatars.githubusercontent.com/u/1045411?v=3","gravatar_id":"","url":"https://api.github.com/users/redknightlois","html_url":"https://github.com/redknightlois","followers_url":"https://api.github.com/users/redknightlois/followers","following_url":"https://api.github.com/users/redknightlois/following{/other_user}","gists_url":"https://api.github.com/users/redknightlois/gists{/gist_id}","starred_url":"https://api.github.com/users/redknightlois/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/redknightlois/subscriptions","organizations_url":"https://api.github.com/users/redknightlois/orgs","repos_url":"https://api.github.com/users/redknightlois/repos","events_url":"https://api.github.com/users/redknightlois/events{/privacy}","received_events_url":"https://api.github.com/users/redknightlois/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/redknightlois/corefx","description":"This repo contains the .NET Core foundational libraries, called CoreFX. It includes classes for collections, file systems, console, XML, async and many others.","fork":true,"url":"https://api.github.com/repos/redknightlois/corefx","forks_url":"https://api.github.com/repos/redknightlois/corefx/forks","keys_url":"https://api.github.com/repos/redknightlois/corefx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/redknightlois/corefx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/redknightlois/corefx/teams","hooks_url":"https://api.github.com/repos/redknightlois/corefx/hooks","issue_events_url":"https://api.github.com/repos/redknightlois/corefx/issues/events{/number}","events_url":"https://api.github.com/repos/redknightlois/corefx/events","assignees_url":"https://api.github.com/repos/redknightlois/corefx/assignees{/user}","branches_url":"https://api.github.com/repos/redknightlois/corefx/branches{/branch}","tags_url":"https://api.github.com/repos/redknightlois/corefx/tags","blobs_url":"https://api.github.com/repos/redknightlois/corefx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/redknightlois/corefx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/redknightlois/corefx/git/refs{/sha}","trees_url":"https://api.github.com/repos/redknightlois/corefx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/redknightlois/corefx/statuses/{sha}","languages_url":"https://api.github.com/repos/redknightlois/corefx/languages","stargazers_url":"https://api.github.com/repos/redknightlois/corefx/stargazers","contributors_url":"https://api.github.com/repos/redknightlois/corefx/contributors","subscribers_url":"https://api.github.com/repos/redknightlois/corefx/subscribers","subscription_url":"https://api.github.com/repos/redknightlois/corefx/subscription","commits_url":"https://api.github.com/repos/redknightlois/corefx/commits{/sha}","git_commits_url":"https://api.github.com/repos/redknightlois/corefx/git/commits{/sha}","comments_url":"https://api.github.com/repos/redknightlois/corefx/comments{/number}","issue_comment_url":"https://api.github.com/repos/redknightlois/corefx/issues/comments{/number}","contents_url":"https://api.github.com/repos/redknightlois/corefx/contents/{+path}","compare_url":"https://api.github.com/repos/redknightlois/corefx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/redknightlois/corefx/merges","archive_url":"https://api.github.com/repos/redknightlois/corefx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/redknightlois/corefx/downloads","issues_url":"https://api.github.com/repos/redknightlois/corefx/issues{/number}","pulls_url":"https://api.github.com/repos/redknightlois/corefx/pulls{/number}","milestones_url":"https://api.github.com/repos/redknightlois/corefx/milestones{/number}","notifications_url":"https://api.github.com/repos/redknightlois/corefx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/redknightlois/corefx/labels{/name}","releases_url":"https://api.github.com/repos/redknightlois/corefx/releases{/id}","created_at":"2015-10-07T14:46:10Z","updated_at":"2015-10-07T14:46:36Z","pushed_at":"2015-10-07T19:14:47Z","git_url":"git://github.com/redknightlois/corefx.git","ssh_url":"git@github.com:redknightlois/corefx.git","clone_url":"https://github.com/redknightlois/corefx.git","svn_url":"https://github.com/redknightlois/corefx","homepage":"http://dotnet.github.io/core/","size":34785,"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":"4414185df30092a182c450b1e82350dbba2b3b2f","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":26295345,"name":"corefx","full_name":"dotnet/corefx","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/corefx","description":"This repo contains the .NET Core foundational libraries, called CoreFX. It includes classes for collections, file systems, console, XML, async and many others.","fork":false,"url":"https://api.github.com/repos/dotnet/corefx","forks_url":"https://api.github.com/repos/dotnet/corefx/forks","keys_url":"https://api.github.com/repos/dotnet/corefx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dotnet/corefx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dotnet/corefx/teams","hooks_url":"https://api.github.com/repos/dotnet/corefx/hooks","issue_events_url":"https://api.github.com/repos/dotnet/corefx/issues/events{/number}","events_url":"https://api.github.com/repos/dotnet/corefx/events","assignees_url":"https://api.github.com/repos/dotnet/corefx/assignees{/user}","branches_url":"https://api.github.com/repos/dotnet/corefx/branches{/branch}","tags_url":"https://api.github.com/repos/dotnet/corefx/tags","blobs_url":"https://api.github.com/repos/dotnet/corefx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dotnet/corefx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dotnet/corefx/git/refs{/sha}","trees_url":"https://api.github.com/repos/dotnet/corefx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dotnet/corefx/statuses/{sha}","languages_url":"https://api.github.com/repos/dotnet/corefx/languages","stargazers_url":"https://api.github.com/repos/dotnet/corefx/stargazers","contributors_url":"https://api.github.com/repos/dotnet/corefx/contributors","subscribers_url":"https://api.github.com/repos/dotnet/corefx/subscribers","subscription_url":"https://api.github.com/repos/dotnet/corefx/subscription","commits_url":"https://api.github.com/repos/dotnet/corefx/commits{/sha}","git_commits_url":"https://api.github.com/repos/dotnet/corefx/git/commits{/sha}","comments_url":"https://api.github.com/repos/dotnet/corefx/comments{/number}","issue_comment_url":"https://api.github.com/repos/dotnet/corefx/issues/comments{/number}","contents_url":"https://api.github.com/repos/dotnet/corefx/contents/{+path}","compare_url":"https://api.github.com/repos/dotnet/corefx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dotnet/corefx/merges","archive_url":"https://api.github.com/repos/dotnet/corefx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dotnet/corefx/downloads","issues_url":"https://api.github.com/repos/dotnet/corefx/issues{/number}","pulls_url":"https://api.github.com/repos/dotnet/corefx/pulls{/number}","milestones_url":"https://api.github.com/repos/dotnet/corefx/milestones{/number}","notifications_url":"https://api.github.com/repos/dotnet/corefx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dotnet/corefx/labels{/name}","releases_url":"https://api.github.com/repos/dotnet/corefx/releases{/id}","created_at":"2014-11-06T23:42:48Z","updated_at":"2015-10-09T06:04:04Z","pushed_at":"2015-10-09T12:36:40Z","git_url":"git://github.com/dotnet/corefx.git","ssh_url":"git@github.com:dotnet/corefx.git","clone_url":"https://github.com/dotnet/corefx.git","svn_url":"https://github.com/dotnet/corefx","homepage":"http://dotnet.github.io/core/","size":77185,"stargazers_count":8427,"watchers_count":8427,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1843,"mirror_url":null,"open_issues_count":641,"forks":1843,"open_issues":641,"watchers":8427,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/3702"},"html":{"href":"https://github.com/dotnet/corefx/pull/3702"},"issue":{"href":"https://api.github.com/repos/dotnet/corefx/issues/3702"},"comments":{"href":"https://api.github.com/repos/dotnet/corefx/issues/3702/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/3702/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/3702/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/corefx/statuses/c6bed6692906d22b34eaf0e5a8ff90113fb30768"}}}}