{"action":"created","comment":{"url":"https://api.github.com/repos/netty/netty/pulls/comments/230261385","pull_request_review_id":170959801,"id":230261385,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzMDI2MTM4NQ==","diff_hunk":"@@ -332,12 +332,12 @@ public int ensureWritable(int minWritableBytes, boolean force) {\n \n     @Override\n     public ByteBuf order(ByteOrder endianness) {\n-        if (endianness == null) {\n-            throw new NullPointerException(\"endianness\");\n-        }\n         if (endianness == order()) {\n             return this;\n         }\n+        if (endianness == null) {","path":"buffer/src/main/java/io/netty/buffer/AbstractByteBuf.java","position":19,"original_position":19,"commit_id":"e9813839c8383a3b5cccc8cddd7711946b8b5b76","original_commit_id":"e9813839c8383a3b5cccc8cddd7711946b8b5b76","user":{"login":"mosesn","id":156562,"node_id":"MDQ6VXNlcjE1NjU2Mg==","avatar_url":"https://avatars3.githubusercontent.com/u/156562?v=4","gravatar_id":"","url":"https://api.github.com/users/mosesn","html_url":"https://github.com/mosesn","followers_url":"https://api.github.com/users/mosesn/followers","following_url":"https://api.github.com/users/mosesn/following{/other_user}","gists_url":"https://api.github.com/users/mosesn/gists{/gist_id}","starred_url":"https://api.github.com/users/mosesn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mosesn/subscriptions","organizations_url":"https://api.github.com/users/mosesn/orgs","repos_url":"https://api.github.com/users/mosesn/repos","events_url":"https://api.github.com/users/mosesn/events{/privacy}","received_events_url":"https://api.github.com/users/mosesn/received_events","type":"User","site_admin":false},"body":"this change looks unnecessary, can you revert it?","created_at":"2018-11-02T03:28:48Z","updated_at":"2018-11-02T03:54:14Z","html_url":"https://github.com/netty/netty/pull/8437#discussion_r230261385","pull_request_url":"https://api.github.com/repos/netty/netty/pulls/8437","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/netty/netty/pulls/comments/230261385"},"html":{"href":"https://github.com/netty/netty/pull/8437#discussion_r230261385"},"pull_request":{"href":"https://api.github.com/repos/netty/netty/pulls/8437"}}},"pull_request":{"url":"https://api.github.com/repos/netty/netty/pulls/8437","id":226319619,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI2MzE5NjE5","html_url":"https://github.com/netty/netty/pull/8437","diff_url":"https://github.com/netty/netty/pull/8437.diff","patch_url":"https://github.com/netty/netty/pull/8437.patch","issue_url":"https://api.github.com/repos/netty/netty/issues/8437","number":8437,"state":"open","locked":false,"title":"Streamline CompositeByteBuf internals","user":{"login":"njhill","id":16958488,"node_id":"MDQ6VXNlcjE2OTU4NDg4","avatar_url":"https://avatars3.githubusercontent.com/u/16958488?v=4","gravatar_id":"","url":"https://api.github.com/users/njhill","html_url":"https://github.com/njhill","followers_url":"https://api.github.com/users/njhill/followers","following_url":"https://api.github.com/users/njhill/following{/other_user}","gists_url":"https://api.github.com/users/njhill/gists{/gist_id}","starred_url":"https://api.github.com/users/njhill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/njhill/subscriptions","organizations_url":"https://api.github.com/users/njhill/orgs","repos_url":"https://api.github.com/users/njhill/repos","events_url":"https://api.github.com/users/njhill/events{/privacy}","received_events_url":"https://api.github.com/users/njhill/received_events","type":"User","site_admin":false},"body":"Motivation:\r\n\r\n`CompositeByteBuf` is a powerful and versatile abstraction, allowing for manipulation of large data without copying bytes. There is still a non-negligible cost to reading/writing however relative to \"singular\" `ByteBufs`, and this can be mostly eliminated with some rework of the internals.\r\n\r\nMy use case is message modification/transformation while zero-copy proxying. For example replacing a string within a large message with one of a different length\r\n\r\nModifications:\r\n- No longer slice added buffers and unwrap added slices\r\n   - Components store target buf offset relative to position in composite buf\r\n   - Less allocations, object footprint, pointer indirection, offset arithmetic\r\n- Use `Component[]` rather than `ArrayList<Component>`\r\n   - Avoid pointer indirection and duplicate bounds check, more efficient backing array growth\r\n   - Facilitates optimization when doing bulk-inserts - inserting _n_ `ByteBuf`s behind _m_ is now _O(m + n)_ instead of _O(mn)_\r\n- Avoid unnecessary casting and method call indirection via superclass\r\n- Eliminate some duplicate range/ref checks via non-checking versions of `toComponentIndex` and `findComponent`\r\n- Add simple fast-path for `toComponentIndex(0)`; add racy cache of last-accessed Component to `findComponent(int)`\r\n- Override `forEachByte0(...)` and `forEachByteDesc0(...)` methods\r\n- Make use of `RecyclableArrayList` in `nioBuffers(int, int)` (in line with `FasterCompositeByteBuf` impl)\r\n- Modify `addComponents0(boolean,int,Iterable)` to use the `Iterable` directly rather than copy to an array first (and possibly to an `ArrayList` before that)\r\n- Optimize `addComponents0(boolean,int,ByteBuf[],int)` to not perform repeated array insertions and avoid second loop for offset updates\r\n- Simplify other logic in various places, in particular the general pattern used where a sub-range is iterated over\r\n- Add benchmarks to demonstrate some improvements\r\n\r\nWhile refactoring I also came across a couple of clear bugs. They are fixed in these changes but I will open another PR with unit tests and fixes to the current version.\r\n\r\nResult:\r\n\r\nMuch faster creation, manipulation, and access; many fewer allocations and smaller footprint. Benchmark results to follow.","created_at":"2018-10-27T19:58:04Z","updated_at":"2018-11-02T03:54:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"face0ff36ed61993f27771336ef25d2d478e6364","assignee":null,"assignees":[],"requested_reviewers":[{"login":"trustin","id":173918,"node_id":"MDQ6VXNlcjE3MzkxOA==","avatar_url":"https://avatars0.githubusercontent.com/u/173918?v=4","gravatar_id":"","url":"https://api.github.com/users/trustin","html_url":"https://github.com/trustin","followers_url":"https://api.github.com/users/trustin/followers","following_url":"https://api.github.com/users/trustin/following{/other_user}","gists_url":"https://api.github.com/users/trustin/gists{/gist_id}","starred_url":"https://api.github.com/users/trustin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trustin/subscriptions","organizations_url":"https://api.github.com/users/trustin/orgs","repos_url":"https://api.github.com/users/trustin/repos","events_url":"https://api.github.com/users/trustin/events{/privacy}","received_events_url":"https://api.github.com/users/trustin/received_events","type":"User","site_admin":false},{"login":"ejona86","id":2811396,"node_id":"MDQ6VXNlcjI4MTEzOTY=","avatar_url":"https://avatars2.githubusercontent.com/u/2811396?v=4","gravatar_id":"","url":"https://api.github.com/users/ejona86","html_url":"https://github.com/ejona86","followers_url":"https://api.github.com/users/ejona86/followers","following_url":"https://api.github.com/users/ejona86/following{/other_user}","gists_url":"https://api.github.com/users/ejona86/gists{/gist_id}","starred_url":"https://api.github.com/users/ejona86/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ejona86/subscriptions","organizations_url":"https://api.github.com/users/ejona86/orgs","repos_url":"https://api.github.com/users/ejona86/repos","events_url":"https://api.github.com/users/ejona86/events{/privacy}","received_events_url":"https://api.github.com/users/ejona86/received_events","type":"User","site_admin":false},{"login":"bryce-anderson","id":2948506,"node_id":"MDQ6VXNlcjI5NDg1MDY=","avatar_url":"https://avatars2.githubusercontent.com/u/2948506?v=4","gravatar_id":"","url":"https://api.github.com/users/bryce-anderson","html_url":"https://github.com/bryce-anderson","followers_url":"https://api.github.com/users/bryce-anderson/followers","following_url":"https://api.github.com/users/bryce-anderson/following{/other_user}","gists_url":"https://api.github.com/users/bryce-anderson/gists{/gist_id}","starred_url":"https://api.github.com/users/bryce-anderson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bryce-anderson/subscriptions","organizations_url":"https://api.github.com/users/bryce-anderson/orgs","repos_url":"https://api.github.com/users/bryce-anderson/repos","events_url":"https://api.github.com/users/bryce-anderson/events{/privacy}","received_events_url":"https://api.github.com/users/bryce-anderson/received_events","type":"User","site_admin":false},{"login":"Scottmitch","id":7562868,"node_id":"MDQ6VXNlcjc1NjI4Njg=","avatar_url":"https://avatars0.githubusercontent.com/u/7562868?v=4","gravatar_id":"","url":"https://api.github.com/users/Scottmitch","html_url":"https://github.com/Scottmitch","followers_url":"https://api.github.com/users/Scottmitch/followers","following_url":"https://api.github.com/users/Scottmitch/following{/other_user}","gists_url":"https://api.github.com/users/Scottmitch/gists{/gist_id}","starred_url":"https://api.github.com/users/Scottmitch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Scottmitch/subscriptions","organizations_url":"https://api.github.com/users/Scottmitch/orgs","repos_url":"https://api.github.com/users/Scottmitch/repos","events_url":"https://api.github.com/users/Scottmitch/events{/privacy}","received_events_url":"https://api.github.com/users/Scottmitch/received_events","type":"User","site_admin":false},{"login":"carl-mastrangelo","id":8943572,"node_id":"MDQ6VXNlcjg5NDM1NzI=","avatar_url":"https://avatars0.githubusercontent.com/u/8943572?v=4","gravatar_id":"","url":"https://api.github.com/users/carl-mastrangelo","html_url":"https://github.com/carl-mastrangelo","followers_url":"https://api.github.com/users/carl-mastrangelo/followers","following_url":"https://api.github.com/users/carl-mastrangelo/following{/other_user}","gists_url":"https://api.github.com/users/carl-mastrangelo/gists{/gist_id}","starred_url":"https://api.github.com/users/carl-mastrangelo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carl-mastrangelo/subscriptions","organizations_url":"https://api.github.com/users/carl-mastrangelo/orgs","repos_url":"https://api.github.com/users/carl-mastrangelo/repos","events_url":"https://api.github.com/users/carl-mastrangelo/events{/privacy}","received_events_url":"https://api.github.com/users/carl-mastrangelo/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/netty/netty/pulls/8437/commits","review_comments_url":"https://api.github.com/repos/netty/netty/pulls/8437/comments","review_comment_url":"https://api.github.com/repos/netty/netty/pulls/comments{/number}","comments_url":"https://api.github.com/repos/netty/netty/issues/8437/comments","statuses_url":"https://api.github.com/repos/netty/netty/statuses/e9813839c8383a3b5cccc8cddd7711946b8b5b76","head":{"label":"njhill:composite-streamline","ref":"composite-streamline","sha":"e9813839c8383a3b5cccc8cddd7711946b8b5b76","user":{"login":"njhill","id":16958488,"node_id":"MDQ6VXNlcjE2OTU4NDg4","avatar_url":"https://avatars3.githubusercontent.com/u/16958488?v=4","gravatar_id":"","url":"https://api.github.com/users/njhill","html_url":"https://github.com/njhill","followers_url":"https://api.github.com/users/njhill/followers","following_url":"https://api.github.com/users/njhill/following{/other_user}","gists_url":"https://api.github.com/users/njhill/gists{/gist_id}","starred_url":"https://api.github.com/users/njhill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/njhill/subscriptions","organizations_url":"https://api.github.com/users/njhill/orgs","repos_url":"https://api.github.com/users/njhill/repos","events_url":"https://api.github.com/users/njhill/events{/privacy}","received_events_url":"https://api.github.com/users/njhill/received_events","type":"User","site_admin":false},"repo":{"id":133447971,"node_id":"MDEwOlJlcG9zaXRvcnkxMzM0NDc5NzE=","name":"netty","full_name":"njhill/netty","private":false,"owner":{"login":"njhill","id":16958488,"node_id":"MDQ6VXNlcjE2OTU4NDg4","avatar_url":"https://avatars3.githubusercontent.com/u/16958488?v=4","gravatar_id":"","url":"https://api.github.com/users/njhill","html_url":"https://github.com/njhill","followers_url":"https://api.github.com/users/njhill/followers","following_url":"https://api.github.com/users/njhill/following{/other_user}","gists_url":"https://api.github.com/users/njhill/gists{/gist_id}","starred_url":"https://api.github.com/users/njhill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/njhill/subscriptions","organizations_url":"https://api.github.com/users/njhill/orgs","repos_url":"https://api.github.com/users/njhill/repos","events_url":"https://api.github.com/users/njhill/events{/privacy}","received_events_url":"https://api.github.com/users/njhill/received_events","type":"User","site_admin":false},"html_url":"https://github.com/njhill/netty","description":"Netty project - an event-driven asynchronous network application framework","fork":true,"url":"https://api.github.com/repos/njhill/netty","forks_url":"https://api.github.com/repos/njhill/netty/forks","keys_url":"https://api.github.com/repos/njhill/netty/keys{/key_id}","collaborators_url":"https://api.github.com/repos/njhill/netty/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/njhill/netty/teams","hooks_url":"https://api.github.com/repos/njhill/netty/hooks","issue_events_url":"https://api.github.com/repos/njhill/netty/issues/events{/number}","events_url":"https://api.github.com/repos/njhill/netty/events","assignees_url":"https://api.github.com/repos/njhill/netty/assignees{/user}","branches_url":"https://api.github.com/repos/njhill/netty/branches{/branch}","tags_url":"https://api.github.com/repos/njhill/netty/tags","blobs_url":"https://api.github.com/repos/njhill/netty/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/njhill/netty/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/njhill/netty/git/refs{/sha}","trees_url":"https://api.github.com/repos/njhill/netty/git/trees{/sha}","statuses_url":"https://api.github.com/repos/njhill/netty/statuses/{sha}","languages_url":"https://api.github.com/repos/njhill/netty/languages","stargazers_url":"https://api.github.com/repos/njhill/netty/stargazers","contributors_url":"https://api.github.com/repos/njhill/netty/contributors","subscribers_url":"https://api.github.com/repos/njhill/netty/subscribers","subscription_url":"https://api.github.com/repos/njhill/netty/subscription","commits_url":"https://api.github.com/repos/njhill/netty/commits{/sha}","git_commits_url":"https://api.github.com/repos/njhill/netty/git/commits{/sha}","comments_url":"https://api.github.com/repos/njhill/netty/comments{/number}","issue_comment_url":"https://api.github.com/repos/njhill/netty/issues/comments{/number}","contents_url":"https://api.github.com/repos/njhill/netty/contents/{+path}","compare_url":"https://api.github.com/repos/njhill/netty/compare/{base}...{head}","merges_url":"https://api.github.com/repos/njhill/netty/merges","archive_url":"https://api.github.com/repos/njhill/netty/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/njhill/netty/downloads","issues_url":"https://api.github.com/repos/njhill/netty/issues{/number}","pulls_url":"https://api.github.com/repos/njhill/netty/pulls{/number}","milestones_url":"https://api.github.com/repos/njhill/netty/milestones{/number}","notifications_url":"https://api.github.com/repos/njhill/netty/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/njhill/netty/labels{/name}","releases_url":"https://api.github.com/repos/njhill/netty/releases{/id}","deployments_url":"https://api.github.com/repos/njhill/netty/deployments","created_at":"2018-05-15T02:28:01Z","updated_at":"2018-05-15T02:28:14Z","pushed_at":"2018-10-30T20:08:43Z","git_url":"git://github.com/njhill/netty.git","ssh_url":"git@github.com:njhill/netty.git","clone_url":"https://github.com/njhill/netty.git","svn_url":"https://github.com/njhill/netty","homepage":"http://netty.io/","size":52267,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"4.1"}},"base":{"label":"netty:4.1","ref":"4.1","sha":"d4b1202e62e52dc9b5619e666f5b0033d8a32bc9","user":{"login":"netty","id":473791,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ3Mzc5MQ==","avatar_url":"https://avatars1.githubusercontent.com/u/473791?v=4","gravatar_id":"","url":"https://api.github.com/users/netty","html_url":"https://github.com/netty","followers_url":"https://api.github.com/users/netty/followers","following_url":"https://api.github.com/users/netty/following{/other_user}","gists_url":"https://api.github.com/users/netty/gists{/gist_id}","starred_url":"https://api.github.com/users/netty/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/netty/subscriptions","organizations_url":"https://api.github.com/users/netty/orgs","repos_url":"https://api.github.com/users/netty/repos","events_url":"https://api.github.com/users/netty/events{/privacy}","received_events_url":"https://api.github.com/users/netty/received_events","type":"Organization","site_admin":false},"repo":{"id":1064563,"node_id":"MDEwOlJlcG9zaXRvcnkxMDY0NTYz","name":"netty","full_name":"netty/netty","private":false,"owner":{"login":"netty","id":473791,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ3Mzc5MQ==","avatar_url":"https://avatars1.githubusercontent.com/u/473791?v=4","gravatar_id":"","url":"https://api.github.com/users/netty","html_url":"https://github.com/netty","followers_url":"https://api.github.com/users/netty/followers","following_url":"https://api.github.com/users/netty/following{/other_user}","gists_url":"https://api.github.com/users/netty/gists{/gist_id}","starred_url":"https://api.github.com/users/netty/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/netty/subscriptions","organizations_url":"https://api.github.com/users/netty/orgs","repos_url":"https://api.github.com/users/netty/repos","events_url":"https://api.github.com/users/netty/events{/privacy}","received_events_url":"https://api.github.com/users/netty/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/netty/netty","description":"Netty project - an event-driven asynchronous network application framework","fork":false,"url":"https://api.github.com/repos/netty/netty","forks_url":"https://api.github.com/repos/netty/netty/forks","keys_url":"https://api.github.com/repos/netty/netty/keys{/key_id}","collaborators_url":"https://api.github.com/repos/netty/netty/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/netty/netty/teams","hooks_url":"https://api.github.com/repos/netty/netty/hooks","issue_events_url":"https://api.github.com/repos/netty/netty/issues/events{/number}","events_url":"https://api.github.com/repos/netty/netty/events","assignees_url":"https://api.github.com/repos/netty/netty/assignees{/user}","branches_url":"https://api.github.com/repos/netty/netty/branches{/branch}","tags_url":"https://api.github.com/repos/netty/netty/tags","blobs_url":"https://api.github.com/repos/netty/netty/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/netty/netty/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/netty/netty/git/refs{/sha}","trees_url":"https://api.github.com/repos/netty/netty/git/trees{/sha}","statuses_url":"https://api.github.com/repos/netty/netty/statuses/{sha}","languages_url":"https://api.github.com/repos/netty/netty/languages","stargazers_url":"https://api.github.com/repos/netty/netty/stargazers","contributors_url":"https://api.github.com/repos/netty/netty/contributors","subscribers_url":"https://api.github.com/repos/netty/netty/subscribers","subscription_url":"https://api.github.com/repos/netty/netty/subscription","commits_url":"https://api.github.com/repos/netty/netty/commits{/sha}","git_commits_url":"https://api.github.com/repos/netty/netty/git/commits{/sha}","comments_url":"https://api.github.com/repos/netty/netty/comments{/number}","issue_comment_url":"https://api.github.com/repos/netty/netty/issues/comments{/number}","contents_url":"https://api.github.com/repos/netty/netty/contents/{+path}","compare_url":"https://api.github.com/repos/netty/netty/compare/{base}...{head}","merges_url":"https://api.github.com/repos/netty/netty/merges","archive_url":"https://api.github.com/repos/netty/netty/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/netty/netty/downloads","issues_url":"https://api.github.com/repos/netty/netty/issues{/number}","pulls_url":"https://api.github.com/repos/netty/netty/pulls{/number}","milestones_url":"https://api.github.com/repos/netty/netty/milestones{/number}","notifications_url":"https://api.github.com/repos/netty/netty/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/netty/netty/labels{/name}","releases_url":"https://api.github.com/repos/netty/netty/releases{/id}","deployments_url":"https://api.github.com/repos/netty/netty/deployments","created_at":"2010-11-09T09:22:21Z","updated_at":"2018-11-02T03:16:51Z","pushed_at":"2018-11-01T17:49:33Z","git_url":"git://github.com/netty/netty.git","ssh_url":"git@github.com:netty/netty.git","clone_url":"https://github.com/netty/netty.git","svn_url":"https://github.com/netty/netty","homepage":"http://netty.io/","size":52699,"stargazers_count":16318,"watchers_count":16318,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7173,"mirror_url":null,"archived":false,"open_issues_count":405,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":7173,"open_issues":405,"watchers":16318,"default_branch":"4.1"}},"_links":{"self":{"href":"https://api.github.com/repos/netty/netty/pulls/8437"},"html":{"href":"https://github.com/netty/netty/pull/8437"},"issue":{"href":"https://api.github.com/repos/netty/netty/issues/8437"},"comments":{"href":"https://api.github.com/repos/netty/netty/issues/8437/comments"},"review_comments":{"href":"https://api.github.com/repos/netty/netty/pulls/8437/comments"},"review_comment":{"href":"https://api.github.com/repos/netty/netty/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/netty/netty/pulls/8437/commits"},"statuses":{"href":"https://api.github.com/repos/netty/netty/statuses/e9813839c8383a3b5cccc8cddd7711946b8b5b76"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"mosesn"}}