GitHub PullRequestReviewCommentEvent at 2014-10-20 02:24:13
Repository: rust
Actor: Gankro
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/rust-lang/rust/pulls/comments/19066335","id":19066335,"diff_hunk":"@@ -15,100 +15,137 @@\n \n use core::prelude::*;\n \n-use core::cmp;\n use core::default::Default;\n use core::fmt;\n use core::iter;\n+use core::raw::Slice as RawSlice;\n+use core::ptr;\n+use core::kinds::marker;\n+use core::mem;\n+use core::num;\n+\n use std::hash::{Writer, Hash};\n+use std::cmp;\n+\n+use alloc::heap::{allocate, reallocate, deallocate};\n \n use {Deque, Mutable, MutableSeq};\n-use vec::Vec;\n \n static INITIAL_CAPACITY: uint = 8u; // 2^3\n static MINIMUM_CAPACITY: uint = 2u;\n \n /// `RingBuf` is a circular buffer that implements `Deque`.\n-#[deriving(Clone)]\n pub struct RingBuf<T> {\n-    nelts: uint,\n-    lo: uint,\n-    elts: Vec<Option<T>>\n+    head: uint,\n+    tail: uint,\n+    len: uint,","path":"src/libcollections/ringbuf.rs","position":33,"original_position":33,"commit_id":"59c61bc937077a31770e710bc7ddebfb3cf6b20d","original_commit_id":"59c61bc937077a31770e710bc7ddebfb3cf6b20d","user":{"login":"Gankro","id":1136864,"avatar_url":"https://avatars.githubusercontent.com/u/1136864?v=2","gravatar_id":"","url":"https://api.github.com/users/Gankro","html_url":"https://github.com/Gankro","followers_url":"https://api.github.com/users/Gankro/followers","following_url":"https://api.github.com/users/Gankro/following{/other_user}","gists_url":"https://api.github.com/users/Gankro/gists{/gist_id}","starred_url":"https://api.github.com/users/Gankro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Gankro/subscriptions","organizations_url":"https://api.github.com/users/Gankro/orgs","repos_url":"https://api.github.com/users/Gankro/repos","events_url":"https://api.github.com/users/Gankro/events{/privacy}","received_events_url":"https://api.github.com/users/Gankro/received_events","type":"User","site_admin":false},"body":"Should this maybe be called `cap` instead? ","created_at":"2014-10-20T02:24:13Z","updated_at":"2014-10-20T02:24:13Z","html_url":"https://github.com/rust-lang/rust/pull/18170#discussion_r19066335","pull_request_url":"https://api.github.com/repos/rust-lang/rust/pulls/18170","_links":{"self":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/comments/19066335"},"html":{"href":"https://github.com/rust-lang/rust/pull/18170#discussion_r19066335"},"pull_request":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/18170"}}},"pull_request":{"url":"https://api.github.com/repos/rust-lang/rust/pulls/18170","id":22987781,"html_url":"https://github.com/rust-lang/rust/pull/18170","diff_url":"https://github.com/rust-lang/rust/pull/18170.diff","patch_url":"https://github.com/rust-lang/rust/pull/18170.patch","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/18170","number":18170,"state":"open","locked":false,"title":"Remove use of Option<T> inside of RingBuf","user":{"login":"csherratt","id":62622,"avatar_url":"https://avatars.githubusercontent.com/u/62622?v=2","gravatar_id":"","url":"https://api.github.com/users/csherratt","html_url":"https://github.com/csherratt","followers_url":"https://api.github.com/users/csherratt/followers","following_url":"https://api.github.com/users/csherratt/following{/other_user}","gists_url":"https://api.github.com/users/csherratt/gists{/gist_id}","starred_url":"https://api.github.com/users/csherratt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/csherratt/subscriptions","organizations_url":"https://api.github.com/users/csherratt/orgs","repos_url":"https://api.github.com/users/csherratt/repos","events_url":"https://api.github.com/users/csherratt/events{/privacy}","received_events_url":"https://api.github.com/users/csherratt/received_events","type":"User","site_admin":false},"body":"Fix for task in Metabug #18009\r\n\r\nThis changes much of about how RingBuf functions. `lo`, `nelts` are replaced by a more traditional `head` and`tail`. The `Vec<Option<T>>` is replaced by a bare pointer that is managed by the `RingBuf` itself. This also expects the ring buffer to always be size that is a power of 2.\r\n\r\nThis change also includes a number of new tests to cover the some areas that could be of concern with manual memory management.\r\n\r\nThe benchmarks have been reworked since the old ones were benchmarking of the Ring buffers growth rather then the actual test.\r\n\r\n## Benchmark\r\n**Before:**\r\n```\r\ntest ringbuf::tests::bench_grow_1025                       ... bench:      9200 ns/iter (+/- 100)\r\ntest ringbuf::tests::bench_iter_1000                       ... bench:      1341 ns/iter (+/- 34)\r\ntest ringbuf::tests::bench_mut_iter_1000                   ... bench:      2250 ns/iter (+/- 44)\r\ntest ringbuf::tests::bench_new                             ... bench:        22 ns/iter (+/- 0)\r\ntest ringbuf::tests::bench_pop_100                         ... bench:       351 ns/iter (+/- 3)\r\ntest ringbuf::tests::bench_pop_front_100                   ... bench:      1169 ns/iter (+/- 61)\r\ntest ringbuf::tests::bench_push_back_100                   ... bench:       244 ns/iter (+/- 3)\r\ntest ringbuf::tests::bench_push_front_100                  ... bench:       246 ns/iter (+/- 5)\r\n```\r\n**After:**\r\n```\r\ntest ringbuf::tests::bench_grow_1025                       ... bench:      4005 ns/iter (+/- 96)\r\ntest ringbuf::tests::bench_iter_1000                       ... bench:       657 ns/iter (+/- 7)\r\ntest ringbuf::tests::bench_mut_iter_1000                   ... bench:       633 ns/iter (+/- 7)\r\ntest ringbuf::tests::bench_new                             ... bench:        15 ns/iter (+/- 0)\r\ntest ringbuf::tests::bench_pop_100                         ... bench:       210 ns/iter (+/- 0)\r\ntest ringbuf::tests::bench_pop_front_100                   ... bench:       179 ns/iter (+/- 1)\r\ntest ringbuf::tests::bench_push_back_100                   ... bench:       187 ns/iter (+/- 1)\r\ntest ringbuf::tests::bench_push_front_100                  ... bench:       174 ns/iter (+/- 2)\r\n```","created_at":"2014-10-19T23:44:01Z","updated_at":"2014-10-20T02:24:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7a9ed6504b09a99c94a2ce8538109a37088fe88b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/rust-lang/rust/pulls/18170/commits","review_comments_url":"https://api.github.com/repos/rust-lang/rust/pulls/18170/comments","review_comment_url":"https://api.github.com/repos/rust-lang/rust/pulls/comments/{number}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/18170/comments","statuses_url":"https://api.github.com/repos/rust-lang/rust/statuses/59c61bc937077a31770e710bc7ddebfb3cf6b20d","head":{"label":"csherratt:ringbuf-remove-option","ref":"ringbuf-remove-option","sha":"59c61bc937077a31770e710bc7ddebfb3cf6b20d","user":{"login":"csherratt","id":62622,"avatar_url":"https://avatars.githubusercontent.com/u/62622?v=2","gravatar_id":"","url":"https://api.github.com/users/csherratt","html_url":"https://github.com/csherratt","followers_url":"https://api.github.com/users/csherratt/followers","following_url":"https://api.github.com/users/csherratt/following{/other_user}","gists_url":"https://api.github.com/users/csherratt/gists{/gist_id}","starred_url":"https://api.github.com/users/csherratt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/csherratt/subscriptions","organizations_url":"https://api.github.com/users/csherratt/orgs","repos_url":"https://api.github.com/users/csherratt/repos","events_url":"https://api.github.com/users/csherratt/events{/privacy}","received_events_url":"https://api.github.com/users/csherratt/received_events","type":"User","site_admin":false},"repo":{"id":6751040,"name":"rust","full_name":"csherratt/rust","owner":{"login":"csherratt","id":62622,"avatar_url":"https://avatars.githubusercontent.com/u/62622?v=2","gravatar_id":"","url":"https://api.github.com/users/csherratt","html_url":"https://github.com/csherratt","followers_url":"https://api.github.com/users/csherratt/followers","following_url":"https://api.github.com/users/csherratt/following{/other_user}","gists_url":"https://api.github.com/users/csherratt/gists{/gist_id}","starred_url":"https://api.github.com/users/csherratt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/csherratt/subscriptions","organizations_url":"https://api.github.com/users/csherratt/orgs","repos_url":"https://api.github.com/users/csherratt/repos","events_url":"https://api.github.com/users/csherratt/events{/privacy}","received_events_url":"https://api.github.com/users/csherratt/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/csherratt/rust","description":"a safe, concurrent, practical language","fork":true,"url":"https://api.github.com/repos/csherratt/rust","forks_url":"https://api.github.com/repos/csherratt/rust/forks","keys_url":"https://api.github.com/repos/csherratt/rust/keys{/key_id}","collaborators_url":"https://api.github.com/repos/csherratt/rust/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/csherratt/rust/teams","hooks_url":"https://api.github.com/repos/csherratt/rust/hooks","issue_events_url":"https://api.github.com/repos/csherratt/rust/issues/events{/number}","events_url":"https://api.github.com/repos/csherratt/rust/events","assignees_url":"https://api.github.com/repos/csherratt/rust/assignees{/user}","branches_url":"https://api.github.com/repos/csherratt/rust/branches{/branch}","tags_url":"https://api.github.com/repos/csherratt/rust/tags","blobs_url":"https://api.github.com/repos/csherratt/rust/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/csherratt/rust/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/csherratt/rust/git/refs{/sha}","trees_url":"https://api.github.com/repos/csherratt/rust/git/trees{/sha}","statuses_url":"https://api.github.com/repos/csherratt/rust/statuses/{sha}","languages_url":"https://api.github.com/repos/csherratt/rust/languages","stargazers_url":"https://api.github.com/repos/csherratt/rust/stargazers","contributors_url":"https://api.github.com/repos/csherratt/rust/contributors","subscribers_url":"https://api.github.com/repos/csherratt/rust/subscribers","subscription_url":"https://api.github.com/repos/csherratt/rust/subscription","commits_url":"https://api.github.com/repos/csherratt/rust/commits{/sha}","git_commits_url":"https://api.github.com/repos/csherratt/rust/git/commits{/sha}","comments_url":"https://api.github.com/repos/csherratt/rust/comments{/number}","issue_comment_url":"https://api.github.com/repos/csherratt/rust/issues/comments/{number}","contents_url":"https://api.github.com/repos/csherratt/rust/contents/{+path}","compare_url":"https://api.github.com/repos/csherratt/rust/compare/{base}...{head}","merges_url":"https://api.github.com/repos/csherratt/rust/merges","archive_url":"https://api.github.com/repos/csherratt/rust/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/csherratt/rust/downloads","issues_url":"https://api.github.com/repos/csherratt/rust/issues{/number}","pulls_url":"https://api.github.com/repos/csherratt/rust/pulls{/number}","milestones_url":"https://api.github.com/repos/csherratt/rust/milestones{/number}","notifications_url":"https://api.github.com/repos/csherratt/rust/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/csherratt/rust/labels{/name}","releases_url":"https://api.github.com/repos/csherratt/rust/releases{/id}","created_at":"2012-11-18T20:39:23Z","updated_at":"2014-03-31T00:16:42Z","pushed_at":"2014-10-19T23:20:21Z","git_url":"git://github.com/csherratt/rust.git","ssh_url":"git@github.com:csherratt/rust.git","clone_url":"https://github.com/csherratt/rust.git","svn_url":"https://github.com/csherratt/rust","homepage":"http://www.rust-lang.org","size":105651,"stargazers_count":0,"watchers_count":0,"language":"Rust","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":"rust-lang:master","ref":"master","sha":"5cba29d3343ee17b28d39c8d675aa0980d0c5b9c","user":{"login":"rust-lang","id":5430905,"avatar_url":"https://avatars.githubusercontent.com/u/5430905?v=2","gravatar_id":"","url":"https://api.github.com/users/rust-lang","html_url":"https://github.com/rust-lang","followers_url":"https://api.github.com/users/rust-lang/followers","following_url":"https://api.github.com/users/rust-lang/following{/other_user}","gists_url":"https://api.github.com/users/rust-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/rust-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rust-lang/subscriptions","organizations_url":"https://api.github.com/users/rust-lang/orgs","repos_url":"https://api.github.com/users/rust-lang/repos","events_url":"https://api.github.com/users/rust-lang/events{/privacy}","received_events_url":"https://api.github.com/users/rust-lang/received_events","type":"Organization","site_admin":false},"repo":{"id":724712,"name":"rust","full_name":"rust-lang/rust","owner":{"login":"rust-lang","id":5430905,"avatar_url":"https://avatars.githubusercontent.com/u/5430905?v=2","gravatar_id":"","url":"https://api.github.com/users/rust-lang","html_url":"https://github.com/rust-lang","followers_url":"https://api.github.com/users/rust-lang/followers","following_url":"https://api.github.com/users/rust-lang/following{/other_user}","gists_url":"https://api.github.com/users/rust-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/rust-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rust-lang/subscriptions","organizations_url":"https://api.github.com/users/rust-lang/orgs","repos_url":"https://api.github.com/users/rust-lang/repos","events_url":"https://api.github.com/users/rust-lang/events{/privacy}","received_events_url":"https://api.github.com/users/rust-lang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rust-lang/rust","description":"a safe, concurrent, practical language","fork":false,"url":"https://api.github.com/repos/rust-lang/rust","forks_url":"https://api.github.com/repos/rust-lang/rust/forks","keys_url":"https://api.github.com/repos/rust-lang/rust/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rust-lang/rust/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rust-lang/rust/teams","hooks_url":"https://api.github.com/repos/rust-lang/rust/hooks","issue_events_url":"https://api.github.com/repos/rust-lang/rust/issues/events{/number}","events_url":"https://api.github.com/repos/rust-lang/rust/events","assignees_url":"https://api.github.com/repos/rust-lang/rust/assignees{/user}","branches_url":"https://api.github.com/repos/rust-lang/rust/branches{/branch}","tags_url":"https://api.github.com/repos/rust-lang/rust/tags","blobs_url":"https://api.github.com/repos/rust-lang/rust/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rust-lang/rust/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rust-lang/rust/git/refs{/sha}","trees_url":"https://api.github.com/repos/rust-lang/rust/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rust-lang/rust/statuses/{sha}","languages_url":"https://api.github.com/repos/rust-lang/rust/languages","stargazers_url":"https://api.github.com/repos/rust-lang/rust/stargazers","contributors_url":"https://api.github.com/repos/rust-lang/rust/contributors","subscribers_url":"https://api.github.com/repos/rust-lang/rust/subscribers","subscription_url":"https://api.github.com/repos/rust-lang/rust/subscription","commits_url":"https://api.github.com/repos/rust-lang/rust/commits{/sha}","git_commits_url":"https://api.github.com/repos/rust-lang/rust/git/commits{/sha}","comments_url":"https://api.github.com/repos/rust-lang/rust/comments{/number}","issue_comment_url":"https://api.github.com/repos/rust-lang/rust/issues/comments/{number}","contents_url":"https://api.github.com/repos/rust-lang/rust/contents/{+path}","compare_url":"https://api.github.com/repos/rust-lang/rust/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rust-lang/rust/merges","archive_url":"https://api.github.com/repos/rust-lang/rust/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rust-lang/rust/downloads","issues_url":"https://api.github.com/repos/rust-lang/rust/issues{/number}","pulls_url":"https://api.github.com/repos/rust-lang/rust/pulls{/number}","milestones_url":"https://api.github.com/repos/rust-lang/rust/milestones{/number}","notifications_url":"https://api.github.com/repos/rust-lang/rust/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rust-lang/rust/labels{/name}","releases_url":"https://api.github.com/repos/rust-lang/rust/releases{/id}","created_at":"2010-06-16T20:39:03Z","updated_at":"2014-10-19T20:56:30Z","pushed_at":"2014-10-20T01:57:11Z","git_url":"git://github.com/rust-lang/rust.git","ssh_url":"git@github.com:rust-lang/rust.git","clone_url":"https://github.com/rust-lang/rust.git","svn_url":"https://github.com/rust-lang/rust","homepage":"http://www.rust-lang.org","size":498848,"stargazers_count":6987,"watchers_count":6987,"language":"Rust","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1362,"mirror_url":null,"open_issues_count":1985,"forks":1362,"open_issues":1985,"watchers":6987,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/18170"},"html":{"href":"https://github.com/rust-lang/rust/pull/18170"},"issue":{"href":"https://api.github.com/repos/rust-lang/rust/issues/18170"},"comments":{"href":"https://api.github.com/repos/rust-lang/rust/issues/18170/comments"},"review_comments":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/18170/comments"},"review_comment":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/18170/commits"},"statuses":{"href":"https://api.github.com/repos/rust-lang/rust/statuses/59c61bc937077a31770e710bc7ddebfb3cf6b20d"}}}}