{"action":"created","comment":{"url":"https://api.github.com/repos/apache/calcite/pulls/comments/53844993","id":53844993,"diff_hunk":"@@ -200,25 +202,32 @@ public static Class box(Class clazz) {\n \n   /** Reads the contents of an input stream and returns as a string. */\n   public static String readFully(InputStream inputStream) throws IOException {\n-    return _readFully(inputStream).toString();\n+    final byte[] bytes = _readFully(inputStream);\n+    return new String(bytes, 0, bytes.length, StandardCharsets.UTF_8);\n   }\n \n   public static byte[] readFullyToBytes(InputStream inputStream) throws IOException {\n-    return _readFully(inputStream).toByteArray();\n+    return _readFully(inputStream);\n   }\n \n-  /** Reads the contents of an input stream and returns a ByteArrayOutputStrema. */\n-  static ByteArrayOutputStream _readFully(InputStream inputStream) throws IOException {\n+  /**\n+   * Reads the contents of an input stream and returns a byte array.\n+   *\n+   * @param inputStream the input to read from.\n+   * @return A byte array whose length is equal to the number of bytes contained.\n+   */\n+  static byte[] _readFully(InputStream inputStream) throws IOException {\n     final byte[] bytes = new byte[4096];\n-    final ByteArrayOutputStream baos = new ByteArrayOutputStream();\n+    // Avoid the synchronization on ByteArrayOutputStream\n+    final UnsynchronizedBuffer.Writer writer = new UnsynchronizedBuffer.Writer(4096);","path":"avatica/src/main/java/org/apache/calcite/avatica/AvaticaUtils.java","position":43,"original_position":43,"commit_id":"ab55ea1753b2a5cf37307a3b4f6e0daf07a1113e","original_commit_id":"ab55ea1753b2a5cf37307a3b4f6e0daf07a1113e","user":{"login":"vlsi","id":213894,"avatar_url":"https://avatars.githubusercontent.com/u/213894?v=3","gravatar_id":"","url":"https://api.github.com/users/vlsi","html_url":"https://github.com/vlsi","followers_url":"https://api.github.com/users/vlsi/followers","following_url":"https://api.github.com/users/vlsi/following{/other_user}","gists_url":"https://api.github.com/users/vlsi/gists{/gist_id}","starred_url":"https://api.github.com/users/vlsi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vlsi/subscriptions","organizations_url":"https://api.github.com/users/vlsi/orgs","repos_url":"https://api.github.com/users/vlsi/repos","events_url":"https://api.github.com/users/vlsi/events{/privacy}","received_events_url":"https://api.github.com/users/vlsi/received_events","type":"User","site_admin":false},"body":"It would be good if you could actually benchmark that.\r\nThere's another variation: instead of trying to maintain a single `byte[]` result, one might collect `List<byte[]>`, then merge them back at the final `toByteArray` step.\r\n\r\nHave you considered that?","created_at":"2016-02-23T20:31:41Z","updated_at":"2016-02-23T20:31:41Z","html_url":"https://github.com/apache/calcite/pull/197#discussion_r53844993","pull_request_url":"https://api.github.com/repos/apache/calcite/pulls/197","_links":{"self":{"href":"https://api.github.com/repos/apache/calcite/pulls/comments/53844993"},"html":{"href":"https://github.com/apache/calcite/pull/197#discussion_r53844993"},"pull_request":{"href":"https://api.github.com/repos/apache/calcite/pulls/197"}}},"pull_request":{"url":"https://api.github.com/repos/apache/calcite/pulls/197","id":59726928,"html_url":"https://github.com/apache/calcite/pull/197","diff_url":"https://github.com/apache/calcite/pull/197.diff","patch_url":"https://github.com/apache/calcite/pull/197.patch","issue_url":"https://api.github.com/repos/apache/calcite/issues/197","number":197,"state":"open","locked":false,"title":"CALCITE-1091 Avatica performance updates","user":{"login":"joshelser","id":67863,"avatar_url":"https://avatars.githubusercontent.com/u/67863?v=3","gravatar_id":"","url":"https://api.github.com/users/joshelser","html_url":"https://github.com/joshelser","followers_url":"https://api.github.com/users/joshelser/followers","following_url":"https://api.github.com/users/joshelser/following{/other_user}","gists_url":"https://api.github.com/users/joshelser/gists{/gist_id}","starred_url":"https://api.github.com/users/joshelser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joshelser/subscriptions","organizations_url":"https://api.github.com/users/joshelser/orgs","repos_url":"https://api.github.com/users/joshelser/repos","events_url":"https://api.github.com/users/joshelser/events{/privacy}","received_events_url":"https://api.github.com/users/joshelser/received_events","type":"User","site_admin":false},"body":"Potential changeset for Avatica for performance. I need to give them another review before merging in. Putting up a PR for any potentially interested parties.","created_at":"2016-02-17T23:28:30Z","updated_at":"2016-02-23T20:31:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1fcb1323f5a4f941c5a975338e1b6ebb549af411","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/calcite/pulls/197/commits","review_comments_url":"https://api.github.com/repos/apache/calcite/pulls/197/comments","review_comment_url":"https://api.github.com/repos/apache/calcite/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/calcite/issues/197/comments","statuses_url":"https://api.github.com/repos/apache/calcite/statuses/ab55ea1753b2a5cf37307a3b4f6e0daf07a1113e","head":{"label":"joshelser:1091-perf-updates","ref":"1091-perf-updates","sha":"ab55ea1753b2a5cf37307a3b4f6e0daf07a1113e","user":{"login":"joshelser","id":67863,"avatar_url":"https://avatars.githubusercontent.com/u/67863?v=3","gravatar_id":"","url":"https://api.github.com/users/joshelser","html_url":"https://github.com/joshelser","followers_url":"https://api.github.com/users/joshelser/followers","following_url":"https://api.github.com/users/joshelser/following{/other_user}","gists_url":"https://api.github.com/users/joshelser/gists{/gist_id}","starred_url":"https://api.github.com/users/joshelser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joshelser/subscriptions","organizations_url":"https://api.github.com/users/joshelser/orgs","repos_url":"https://api.github.com/users/joshelser/repos","events_url":"https://api.github.com/users/joshelser/events{/privacy}","received_events_url":"https://api.github.com/users/joshelser/received_events","type":"User","site_admin":false},"repo":{"id":40507471,"name":"calcite","full_name":"joshelser/calcite","owner":{"login":"joshelser","id":67863,"avatar_url":"https://avatars.githubusercontent.com/u/67863?v=3","gravatar_id":"","url":"https://api.github.com/users/joshelser","html_url":"https://github.com/joshelser","followers_url":"https://api.github.com/users/joshelser/followers","following_url":"https://api.github.com/users/joshelser/following{/other_user}","gists_url":"https://api.github.com/users/joshelser/gists{/gist_id}","starred_url":"https://api.github.com/users/joshelser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joshelser/subscriptions","organizations_url":"https://api.github.com/users/joshelser/orgs","repos_url":"https://api.github.com/users/joshelser/repos","events_url":"https://api.github.com/users/joshelser/events{/privacy}","received_events_url":"https://api.github.com/users/joshelser/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/joshelser/calcite","description":"Mirror of Apache Calcite","fork":true,"url":"https://api.github.com/repos/joshelser/calcite","forks_url":"https://api.github.com/repos/joshelser/calcite/forks","keys_url":"https://api.github.com/repos/joshelser/calcite/keys{/key_id}","collaborators_url":"https://api.github.com/repos/joshelser/calcite/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/joshelser/calcite/teams","hooks_url":"https://api.github.com/repos/joshelser/calcite/hooks","issue_events_url":"https://api.github.com/repos/joshelser/calcite/issues/events{/number}","events_url":"https://api.github.com/repos/joshelser/calcite/events","assignees_url":"https://api.github.com/repos/joshelser/calcite/assignees{/user}","branches_url":"https://api.github.com/repos/joshelser/calcite/branches{/branch}","tags_url":"https://api.github.com/repos/joshelser/calcite/tags","blobs_url":"https://api.github.com/repos/joshelser/calcite/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/joshelser/calcite/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/joshelser/calcite/git/refs{/sha}","trees_url":"https://api.github.com/repos/joshelser/calcite/git/trees{/sha}","statuses_url":"https://api.github.com/repos/joshelser/calcite/statuses/{sha}","languages_url":"https://api.github.com/repos/joshelser/calcite/languages","stargazers_url":"https://api.github.com/repos/joshelser/calcite/stargazers","contributors_url":"https://api.github.com/repos/joshelser/calcite/contributors","subscribers_url":"https://api.github.com/repos/joshelser/calcite/subscribers","subscription_url":"https://api.github.com/repos/joshelser/calcite/subscription","commits_url":"https://api.github.com/repos/joshelser/calcite/commits{/sha}","git_commits_url":"https://api.github.com/repos/joshelser/calcite/git/commits{/sha}","comments_url":"https://api.github.com/repos/joshelser/calcite/comments{/number}","issue_comment_url":"https://api.github.com/repos/joshelser/calcite/issues/comments{/number}","contents_url":"https://api.github.com/repos/joshelser/calcite/contents/{+path}","compare_url":"https://api.github.com/repos/joshelser/calcite/compare/{base}...{head}","merges_url":"https://api.github.com/repos/joshelser/calcite/merges","archive_url":"https://api.github.com/repos/joshelser/calcite/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/joshelser/calcite/downloads","issues_url":"https://api.github.com/repos/joshelser/calcite/issues{/number}","pulls_url":"https://api.github.com/repos/joshelser/calcite/pulls{/number}","milestones_url":"https://api.github.com/repos/joshelser/calcite/milestones{/number}","notifications_url":"https://api.github.com/repos/joshelser/calcite/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/joshelser/calcite/labels{/name}","releases_url":"https://api.github.com/repos/joshelser/calcite/releases{/id}","deployments_url":"https://api.github.com/repos/joshelser/calcite/deployments","created_at":"2015-08-10T21:38:53Z","updated_at":"2016-01-27T23:09:04Z","pushed_at":"2016-02-18T04:55:19Z","git_url":"git://github.com/joshelser/calcite.git","ssh_url":"git@github.com:joshelser/calcite.git","clone_url":"https://github.com/joshelser/calcite.git","svn_url":"https://github.com/joshelser/calcite","homepage":"","size":24219,"stargazers_count":0,"watchers_count":0,"language":"Java","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":"apache:master","ref":"master","sha":"8bbef2d6fbba8547adc55dcbb7d5b07a7a5437bc","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":21193524,"name":"calcite","full_name":"apache/calcite","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/calcite","description":"Mirror of Apache Calcite","fork":false,"url":"https://api.github.com/repos/apache/calcite","forks_url":"https://api.github.com/repos/apache/calcite/forks","keys_url":"https://api.github.com/repos/apache/calcite/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/calcite/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/calcite/teams","hooks_url":"https://api.github.com/repos/apache/calcite/hooks","issue_events_url":"https://api.github.com/repos/apache/calcite/issues/events{/number}","events_url":"https://api.github.com/repos/apache/calcite/events","assignees_url":"https://api.github.com/repos/apache/calcite/assignees{/user}","branches_url":"https://api.github.com/repos/apache/calcite/branches{/branch}","tags_url":"https://api.github.com/repos/apache/calcite/tags","blobs_url":"https://api.github.com/repos/apache/calcite/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/calcite/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/calcite/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/calcite/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/calcite/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/calcite/languages","stargazers_url":"https://api.github.com/repos/apache/calcite/stargazers","contributors_url":"https://api.github.com/repos/apache/calcite/contributors","subscribers_url":"https://api.github.com/repos/apache/calcite/subscribers","subscription_url":"https://api.github.com/repos/apache/calcite/subscription","commits_url":"https://api.github.com/repos/apache/calcite/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/calcite/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/calcite/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/calcite/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/calcite/contents/{+path}","compare_url":"https://api.github.com/repos/apache/calcite/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/calcite/merges","archive_url":"https://api.github.com/repos/apache/calcite/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/calcite/downloads","issues_url":"https://api.github.com/repos/apache/calcite/issues{/number}","pulls_url":"https://api.github.com/repos/apache/calcite/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/calcite/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/calcite/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/calcite/labels{/name}","releases_url":"https://api.github.com/repos/apache/calcite/releases{/id}","deployments_url":"https://api.github.com/repos/apache/calcite/deployments","created_at":"2014-06-25T07:00:07Z","updated_at":"2016-02-23T02:27:21Z","pushed_at":"2016-02-21T18:02:41Z","git_url":"git://github.com/apache/calcite.git","ssh_url":"git@github.com:apache/calcite.git","clone_url":"https://github.com/apache/calcite.git","svn_url":"https://github.com/apache/calcite","homepage":"","size":27592,"stargazers_count":180,"watchers_count":180,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":146,"mirror_url":"git://git.apache.org/calcite.git","open_issues_count":8,"forks":146,"open_issues":8,"watchers":180,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/calcite/pulls/197"},"html":{"href":"https://github.com/apache/calcite/pull/197"},"issue":{"href":"https://api.github.com/repos/apache/calcite/issues/197"},"comments":{"href":"https://api.github.com/repos/apache/calcite/issues/197/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/calcite/pulls/197/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/calcite/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/calcite/pulls/197/commits"},"statuses":{"href":"https://api.github.com/repos/apache/calcite/statuses/ab55ea1753b2a5cf37307a3b4f6e0daf07a1113e"}}}}