{"action":"closed","issue":{"url":"https://api.github.com/repos/netty/netty/issues/4807","repository_url":"https://api.github.com/repos/netty/netty","labels_url":"https://api.github.com/repos/netty/netty/issues/4807/labels{/name}","comments_url":"https://api.github.com/repos/netty/netty/issues/4807/comments","events_url":"https://api.github.com/repos/netty/netty/issues/4807/events","html_url":"https://github.com/netty/netty/issues/4807","id":130523575,"number":4807,"title":"AppendableCharSequence#append(char) uses IOOBE for expansion","user":{"login":"rkapsi","id":191635,"avatar_url":"https://avatars.githubusercontent.com/u/191635?v=3","gravatar_id":"","url":"https://api.github.com/users/rkapsi","html_url":"https://github.com/rkapsi","followers_url":"https://api.github.com/users/rkapsi/followers","following_url":"https://api.github.com/users/rkapsi/following{/other_user}","gists_url":"https://api.github.com/users/rkapsi/gists{/gist_id}","starred_url":"https://api.github.com/users/rkapsi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rkapsi/subscriptions","organizations_url":"https://api.github.com/users/rkapsi/orgs","repos_url":"https://api.github.com/users/rkapsi/repos","events_url":"https://api.github.com/users/rkapsi/events{/privacy}","received_events_url":"https://api.github.com/users/rkapsi/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/netty/netty/labels/feature","name":"feature","color":"009800"}],"state":"closed","locked":false,"assignee":{"login":"Scottmitch","id":7562868,"avatar_url":"https://avatars.githubusercontent.com/u/7562868?v=3","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},"milestone":{"url":"https://api.github.com/repos/netty/netty/milestones/134","html_url":"https://github.com/netty/netty/milestones/4.0.35.Final","labels_url":"https://api.github.com/repos/netty/netty/milestones/134/labels","id":1551157,"number":134,"title":"4.0.35.Final","description":"","creator":{"login":"normanmaurer","id":439362,"avatar_url":"https://avatars.githubusercontent.com/u/439362?v=3","gravatar_id":"","url":"https://api.github.com/users/normanmaurer","html_url":"https://github.com/normanmaurer","followers_url":"https://api.github.com/users/normanmaurer/followers","following_url":"https://api.github.com/users/normanmaurer/following{/other_user}","gists_url":"https://api.github.com/users/normanmaurer/gists{/gist_id}","starred_url":"https://api.github.com/users/normanmaurer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/normanmaurer/subscriptions","organizations_url":"https://api.github.com/users/normanmaurer/orgs","repos_url":"https://api.github.com/users/normanmaurer/repos","events_url":"https://api.github.com/users/normanmaurer/events{/privacy}","received_events_url":"https://api.github.com/users/normanmaurer/received_events","type":"User","site_admin":false},"open_issues":64,"closed_issues":31,"state":"open","created_at":"2016-01-29T13:17:12Z","updated_at":"2016-02-08T05:23:37Z","due_on":null,"closed_at":null},"comments":8,"created_at":"2016-02-01T23:55:09Z","updated_at":"2016-02-08T05:23:37Z","closed_at":"2016-02-08T05:23:37Z","body":"Hello,\r\n\r\nI did some profiling in our production environment and noticed that `AppendableCharSequence#append(char)` catches `IndexOutOfBoundsException` to expand its internal `char[]` (in our case called via HTTP header parser, see linked screenshot).\r\n\r\nI don't know if it's on purpose (there used to be a pattern around that) but\r\nthrowing+catching exceptions is in my experience more expensive than something as simple as:\r\n\r\n```java\r\nif (pos >= chars.length) {\r\n  expand();\r\n}\r\nchars[pos++] = c;\r\n```\r\n\r\nAdditionally it's screwing and possibly distracting the profiler/developer from real exceptions.\r\n\r\nNetty 4.1.0-CR2-SNAPSHOT\r\n\r\nhttp://pasteboard.co/1eVXi7nC.png\r\n"}}