{"action":"created","comment":{"url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/pulls/comments/48679939","id":48679939,"diff_hunk":"@@ -263,9 +265,17 @@ public struct SignalProducer<Value, Error: ErrorType> {\n }\n \n private struct BufferState<Value, Error: ErrorType> {\n-\t// All values in the buffer.\n-\tvar values: [Value] = []\n-\n+    \n+    init(capacity: Int) {","path":"ReactiveCocoa/Swift/SignalProducer.swift","position":42,"original_position":42,"commit_id":"95191ba07a002adafe9b2560055f2cc52e4942fd","original_commit_id":"95191ba07a002adafe9b2560055f2cc52e4942fd","user":{"login":"SandyChapman","id":3920249,"avatar_url":"https://avatars.githubusercontent.com/u/3920249?v=3","gravatar_id":"","url":"https://api.github.com/users/SandyChapman","html_url":"https://github.com/SandyChapman","followers_url":"https://api.github.com/users/SandyChapman/followers","following_url":"https://api.github.com/users/SandyChapman/following{/other_user}","gists_url":"https://api.github.com/users/SandyChapman/gists{/gist_id}","starred_url":"https://api.github.com/users/SandyChapman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SandyChapman/subscriptions","organizations_url":"https://api.github.com/users/SandyChapman/orgs","repos_url":"https://api.github.com/users/SandyChapman/repos","events_url":"https://api.github.com/users/SandyChapman/events{/privacy}","received_events_url":"https://api.github.com/users/SandyChapman/received_events","type":"User","site_admin":false},"body":"Sure, I'll convert them.","created_at":"2016-01-01T19:49:57Z","updated_at":"2016-01-01T19:49:57Z","html_url":"https://github.com/ReactiveCocoa/ReactiveCocoa/pull/2638#discussion_r48679939","pull_request_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/pulls/2638","_links":{"self":{"href":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/pulls/comments/48679939"},"html":{"href":"https://github.com/ReactiveCocoa/ReactiveCocoa/pull/2638#discussion_r48679939"},"pull_request":{"href":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/pulls/2638"}}},"pull_request":{"url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/pulls/2638","id":54878373,"html_url":"https://github.com/ReactiveCocoa/ReactiveCocoa/pull/2638","diff_url":"https://github.com/ReactiveCocoa/ReactiveCocoa/pull/2638.diff","patch_url":"https://github.com/ReactiveCocoa/ReactiveCocoa/pull/2638.patch","issue_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/issues/2638","number":2638,"state":"open","locked":false,"title":"Use O(1) additions to the BufferState class.","user":{"login":"SandyChapman","id":3920249,"avatar_url":"https://avatars.githubusercontent.com/u/3920249?v=3","gravatar_id":"","url":"https://api.github.com/users/SandyChapman","html_url":"https://github.com/SandyChapman","followers_url":"https://api.github.com/users/SandyChapman/followers","following_url":"https://api.github.com/users/SandyChapman/following{/other_user}","gists_url":"https://api.github.com/users/SandyChapman/gists{/gist_id}","starred_url":"https://api.github.com/users/SandyChapman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SandyChapman/subscriptions","organizations_url":"https://api.github.com/users/SandyChapman/orgs","repos_url":"https://api.github.com/users/SandyChapman/repos","events_url":"https://api.github.com/users/SandyChapman/events{/privacy}","received_events_url":"https://api.github.com/users/SandyChapman/received_events","type":"User","site_admin":false},"body":"Measurements with capacity:\r\n\r\nValue in header represent capacity.\r\nValue in table represents execution time in seconds.\r\n\r\nNote that this solution trades memory space for speed. If the code isn't desired, then I suggest at least we add the special case for a buffer containing a single value (since this applies to MutableProperties).\r\n\r\nAdd Value @ 500,000 iterations | 1 | 10 | 100 | 1000 | 10000 \r\n------------- | ------------- | ------------- | ------------- | ------------- | -------------\r\nnow | 1.34 | 1.27 | 1.37 | 3.14 |20.8\r\nnew|0.354|0.59|0.587|0.603|0.615\r\n        \r\n        \r\niterate empty @ 100,000 iterations | 1 | 10 | 100 | 1000 | 10000\r\n------------- | ------------- | ------------- | ------------- | ------------- | -------------\r\nnow | 0.0995 | 0.104 | 0.103 | 0.104 | \r\nnew | 0.16 | 0.159 | 0.162 | 0.171 | \r\n        \r\n        \r\niterate half full @ 100,000 iterations | 1 | 10 | 100 | 1000 | 10000\r\n------------- | ------------- | ------------- | ------------- | ------------- | -------------\r\nnow | 0.167 | 0.444 | 2.96 | 28.9 | \r\nnew | 0.159 | 0.502 | 3.03 | 29 | \r\n        \r\n        \r\niterate full @ 100,000 iterations | 1 | 10 | 100 | 1000 | 10000\r\n------------- | ------------- | ------------- | ------------- | ------------- | -------------\r\nnow | 0.167 | 0.675 | 5.71 | 57.6 | \r\nnew | 0.156 | 0.722 | 5.95 | 57.7 | ","created_at":"2015-12-31T19:59:53Z","updated_at":"2016-01-01T19:49:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dd6c50667e589c423977a1ccc464816383cbe016","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/pulls/2638/commits","review_comments_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/pulls/2638/comments","review_comment_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/issues/2638/comments","statuses_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/statuses/95191ba07a002adafe9b2560055f2cc52e4942fd","head":{"label":"lixar:fast_buffer_state","ref":"fast_buffer_state","sha":"95191ba07a002adafe9b2560055f2cc52e4942fd","user":{"login":"lixar","id":1770362,"avatar_url":"https://avatars.githubusercontent.com/u/1770362?v=3","gravatar_id":"","url":"https://api.github.com/users/lixar","html_url":"https://github.com/lixar","followers_url":"https://api.github.com/users/lixar/followers","following_url":"https://api.github.com/users/lixar/following{/other_user}","gists_url":"https://api.github.com/users/lixar/gists{/gist_id}","starred_url":"https://api.github.com/users/lixar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lixar/subscriptions","organizations_url":"https://api.github.com/users/lixar/orgs","repos_url":"https://api.github.com/users/lixar/repos","events_url":"https://api.github.com/users/lixar/events{/privacy}","received_events_url":"https://api.github.com/users/lixar/received_events","type":"Organization","site_admin":false},"repo":{"id":41873077,"name":"ReactiveCocoa","full_name":"lixar/ReactiveCocoa","owner":{"login":"lixar","id":1770362,"avatar_url":"https://avatars.githubusercontent.com/u/1770362?v=3","gravatar_id":"","url":"https://api.github.com/users/lixar","html_url":"https://github.com/lixar","followers_url":"https://api.github.com/users/lixar/followers","following_url":"https://api.github.com/users/lixar/following{/other_user}","gists_url":"https://api.github.com/users/lixar/gists{/gist_id}","starred_url":"https://api.github.com/users/lixar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lixar/subscriptions","organizations_url":"https://api.github.com/users/lixar/orgs","repos_url":"https://api.github.com/users/lixar/repos","events_url":"https://api.github.com/users/lixar/events{/privacy}","received_events_url":"https://api.github.com/users/lixar/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/lixar/ReactiveCocoa","description":"Streams of values over time","fork":true,"url":"https://api.github.com/repos/lixar/ReactiveCocoa","forks_url":"https://api.github.com/repos/lixar/ReactiveCocoa/forks","keys_url":"https://api.github.com/repos/lixar/ReactiveCocoa/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lixar/ReactiveCocoa/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lixar/ReactiveCocoa/teams","hooks_url":"https://api.github.com/repos/lixar/ReactiveCocoa/hooks","issue_events_url":"https://api.github.com/repos/lixar/ReactiveCocoa/issues/events{/number}","events_url":"https://api.github.com/repos/lixar/ReactiveCocoa/events","assignees_url":"https://api.github.com/repos/lixar/ReactiveCocoa/assignees{/user}","branches_url":"https://api.github.com/repos/lixar/ReactiveCocoa/branches{/branch}","tags_url":"https://api.github.com/repos/lixar/ReactiveCocoa/tags","blobs_url":"https://api.github.com/repos/lixar/ReactiveCocoa/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lixar/ReactiveCocoa/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lixar/ReactiveCocoa/git/refs{/sha}","trees_url":"https://api.github.com/repos/lixar/ReactiveCocoa/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lixar/ReactiveCocoa/statuses/{sha}","languages_url":"https://api.github.com/repos/lixar/ReactiveCocoa/languages","stargazers_url":"https://api.github.com/repos/lixar/ReactiveCocoa/stargazers","contributors_url":"https://api.github.com/repos/lixar/ReactiveCocoa/contributors","subscribers_url":"https://api.github.com/repos/lixar/ReactiveCocoa/subscribers","subscription_url":"https://api.github.com/repos/lixar/ReactiveCocoa/subscription","commits_url":"https://api.github.com/repos/lixar/ReactiveCocoa/commits{/sha}","git_commits_url":"https://api.github.com/repos/lixar/ReactiveCocoa/git/commits{/sha}","comments_url":"https://api.github.com/repos/lixar/ReactiveCocoa/comments{/number}","issue_comment_url":"https://api.github.com/repos/lixar/ReactiveCocoa/issues/comments{/number}","contents_url":"https://api.github.com/repos/lixar/ReactiveCocoa/contents/{+path}","compare_url":"https://api.github.com/repos/lixar/ReactiveCocoa/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lixar/ReactiveCocoa/merges","archive_url":"https://api.github.com/repos/lixar/ReactiveCocoa/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lixar/ReactiveCocoa/downloads","issues_url":"https://api.github.com/repos/lixar/ReactiveCocoa/issues{/number}","pulls_url":"https://api.github.com/repos/lixar/ReactiveCocoa/pulls{/number}","milestones_url":"https://api.github.com/repos/lixar/ReactiveCocoa/milestones{/number}","notifications_url":"https://api.github.com/repos/lixar/ReactiveCocoa/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lixar/ReactiveCocoa/labels{/name}","releases_url":"https://api.github.com/repos/lixar/ReactiveCocoa/releases{/id}","created_at":"2015-09-03T17:15:48Z","updated_at":"2015-09-03T17:15:51Z","pushed_at":"2015-12-31T19:48:33Z","git_url":"git://github.com/lixar/ReactiveCocoa.git","ssh_url":"git@github.com:lixar/ReactiveCocoa.git","clone_url":"https://github.com/lixar/ReactiveCocoa.git","svn_url":"https://github.com/lixar/ReactiveCocoa","homepage":"","size":15249,"stargazers_count":0,"watchers_count":0,"language":"Objective-C","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"ReactiveCocoa:master","ref":"master","sha":"aa8b168d2f762e473c2ff6a724084fc2ec8846b9","user":{"login":"ReactiveCocoa","id":3422977,"avatar_url":"https://avatars.githubusercontent.com/u/3422977?v=3","gravatar_id":"","url":"https://api.github.com/users/ReactiveCocoa","html_url":"https://github.com/ReactiveCocoa","followers_url":"https://api.github.com/users/ReactiveCocoa/followers","following_url":"https://api.github.com/users/ReactiveCocoa/following{/other_user}","gists_url":"https://api.github.com/users/ReactiveCocoa/gists{/gist_id}","starred_url":"https://api.github.com/users/ReactiveCocoa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ReactiveCocoa/subscriptions","organizations_url":"https://api.github.com/users/ReactiveCocoa/orgs","repos_url":"https://api.github.com/users/ReactiveCocoa/repos","events_url":"https://api.github.com/users/ReactiveCocoa/events{/privacy}","received_events_url":"https://api.github.com/users/ReactiveCocoa/received_events","type":"Organization","site_admin":false},"repo":{"id":3606624,"name":"ReactiveCocoa","full_name":"ReactiveCocoa/ReactiveCocoa","owner":{"login":"ReactiveCocoa","id":3422977,"avatar_url":"https://avatars.githubusercontent.com/u/3422977?v=3","gravatar_id":"","url":"https://api.github.com/users/ReactiveCocoa","html_url":"https://github.com/ReactiveCocoa","followers_url":"https://api.github.com/users/ReactiveCocoa/followers","following_url":"https://api.github.com/users/ReactiveCocoa/following{/other_user}","gists_url":"https://api.github.com/users/ReactiveCocoa/gists{/gist_id}","starred_url":"https://api.github.com/users/ReactiveCocoa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ReactiveCocoa/subscriptions","organizations_url":"https://api.github.com/users/ReactiveCocoa/orgs","repos_url":"https://api.github.com/users/ReactiveCocoa/repos","events_url":"https://api.github.com/users/ReactiveCocoa/events{/privacy}","received_events_url":"https://api.github.com/users/ReactiveCocoa/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ReactiveCocoa/ReactiveCocoa","description":"Streams of values over time","fork":false,"url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa","forks_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/forks","keys_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/teams","hooks_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/hooks","issue_events_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/issues/events{/number}","events_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/events","assignees_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/assignees{/user}","branches_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/branches{/branch}","tags_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/tags","blobs_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/git/refs{/sha}","trees_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/statuses/{sha}","languages_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/languages","stargazers_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/stargazers","contributors_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/contributors","subscribers_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/subscribers","subscription_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/subscription","commits_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/commits{/sha}","git_commits_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/git/commits{/sha}","comments_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/comments{/number}","issue_comment_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/issues/comments{/number}","contents_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/contents/{+path}","compare_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/merges","archive_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/downloads","issues_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/issues{/number}","pulls_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/pulls{/number}","milestones_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/milestones{/number}","notifications_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/labels{/name}","releases_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/releases{/id}","created_at":"2012-03-02T22:11:24Z","updated_at":"2016-01-01T17:28:53Z","pushed_at":"2015-12-31T19:59:54Z","git_url":"git://github.com/ReactiveCocoa/ReactiveCocoa.git","ssh_url":"git@github.com:ReactiveCocoa/ReactiveCocoa.git","clone_url":"https://github.com/ReactiveCocoa/ReactiveCocoa.git","svn_url":"https://github.com/ReactiveCocoa/ReactiveCocoa","homepage":"","size":23424,"stargazers_count":11993,"watchers_count":11993,"language":"Objective-C","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2123,"mirror_url":null,"open_issues_count":220,"forks":2123,"open_issues":220,"watchers":11993,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/pulls/2638"},"html":{"href":"https://github.com/ReactiveCocoa/ReactiveCocoa/pull/2638"},"issue":{"href":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/issues/2638"},"comments":{"href":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/issues/2638/comments"},"review_comments":{"href":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/pulls/2638/comments"},"review_comment":{"href":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/pulls/2638/commits"},"statuses":{"href":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/statuses/95191ba07a002adafe9b2560055f2cc52e4942fd"}}}}