{"action":"created","comment":{"url":"https://api.github.com/repos/ktoso/akka/pulls/comments/42236176","id":42236176,"diff_hunk":"@@ -44,70 +44,65 @@ class JsonCollectingBuffer {\n   private var objectDepthLevel = 0\n \n   def append(input: ByteString): Unit =\n-    if (isValid)\n-      if (input.length > 1)\n-        input.foreach(c ⇒ append(ByteString(c)))\n-      else {\n-        input.head match {\n-          case ByteValue.SquareBraceStart if !isStartOfObject ⇒\n-          // do nothing\n-\n-          case ByteValue.SquareBraceEnd if !isStartOfObject   ⇒\n-          // do nothing\n-\n-          case ByteValue.Comma if !isStartOfObject            ⇒\n-          // do nothing\n-\n-          case ByteValue.Backslash ⇒\n-            isStartOfEscapeSequence = true\n-            buffer ++= input\n-\n-          case ByteValue.DoubleQuote ⇒\n-            if (!isStartOfEscapeSequence) isStartOfStringExpression = !isStartOfStringExpression\n-            isStartOfEscapeSequence = false\n-            buffer ++= input\n-\n-          case ByteValue.CurlyBraceStart if !isStartOfStringExpression ⇒\n-            isStartOfEscapeSequence = false\n-            objectDepthLevel += 1\n-            buffer ++= input\n-\n-          case ByteValue.CurlyBraceEnd if !isStartOfStringExpression ⇒\n-            isStartOfEscapeSequence = false\n-            objectDepthLevel -= 1\n-            buffer ++= input\n-            if (objectDepthLevel == 0)\n-              completedObjectIndexes :+= buffer.length\n-\n-          case otherValue if ByteValue.Whitespace.isWhitespace(otherValue) && !isStartOfStringExpression ⇒\n-          // skip\n-\n-          case otherValue if isStartOfObject ⇒\n-            isStartOfEscapeSequence = false\n-            buffer ++= input\n-\n-          case _ ⇒\n-            isValid = false\n-        }\n+    if (isValid && input.nonEmpty) {\n+      var idx = 0\n+      val length = input.length\n+      while (idx < length) {\n+        appendByte(input(idx))\n+        idx += 1","path":"akka-http-marshallers-scala/akka-http-spray-json/src/main/scala/akka/http/scaladsl/server/JsonCollectingBuffer.scala","position":54,"original_position":54,"commit_id":"13ad2220bfa25ef4f1208ae077b7b215e387d2fc","original_commit_id":"13ad2220bfa25ef4f1208ae077b7b215e387d2fc","user":{"login":"ktoso","id":120979,"avatar_url":"https://avatars.githubusercontent.com/u/120979?v=3","gravatar_id":"","url":"https://api.github.com/users/ktoso","html_url":"https://github.com/ktoso","followers_url":"https://api.github.com/users/ktoso/followers","following_url":"https://api.github.com/users/ktoso/following{/other_user}","gists_url":"https://api.github.com/users/ktoso/gists{/gist_id}","starred_url":"https://api.github.com/users/ktoso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ktoso/subscriptions","organizations_url":"https://api.github.com/users/ktoso/orgs","repos_url":"https://api.github.com/users/ktoso/repos","events_url":"https://api.github.com/users/ktoso/events{/privacy}","received_events_url":"https://api.github.com/users/ktoso/received_events","type":"User","site_admin":false},"body":":+1: ","created_at":"2015-10-16T12:20:07Z","updated_at":"2015-10-16T12:20:07Z","html_url":"https://github.com/ktoso/akka/pull/4#discussion_r42236176","pull_request_url":"https://api.github.com/repos/ktoso/akka/pulls/4","_links":{"self":{"href":"https://api.github.com/repos/ktoso/akka/pulls/comments/42236176"},"html":{"href":"https://github.com/ktoso/akka/pull/4#discussion_r42236176"},"pull_request":{"href":"https://api.github.com/repos/ktoso/akka/pulls/4"}}},"pull_request":{"url":"https://api.github.com/repos/ktoso/akka/pulls/4","id":47903130,"html_url":"https://github.com/ktoso/akka/pull/4","diff_url":"https://github.com/ktoso/akka/pull/4.diff","patch_url":"https://github.com/ktoso/akka/pull/4.patch","issue_url":"https://api.github.com/repos/ktoso/akka/issues/4","number":4,"state":"open","locked":false,"title":"Wip Perf tweaks for JSON Parsing","user":{"login":"fsat","id":1665611,"avatar_url":"https://avatars.githubusercontent.com/u/1665611?v=3","gravatar_id":"","url":"https://api.github.com/users/fsat","html_url":"https://github.com/fsat","followers_url":"https://api.github.com/users/fsat/followers","following_url":"https://api.github.com/users/fsat/following{/other_user}","gists_url":"https://api.github.com/users/fsat/gists{/gist_id}","starred_url":"https://api.github.com/users/fsat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fsat/subscriptions","organizations_url":"https://api.github.com/users/fsat/orgs","repos_url":"https://api.github.com/users/fsat/repos","events_url":"https://api.github.com/users/fsat/events{/privacy}","received_events_url":"https://api.github.com/users/fsat/received_events","type":"User","site_admin":false},"body":"Replace for comprehension and pattern match in lieu of if/else statement for wire level performance.","created_at":"2015-10-16T12:17:45Z","updated_at":"2015-10-16T12:20:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9b4242171781f7b574fa5278492e1ea68625c9e8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ktoso/akka/pulls/4/commits","review_comments_url":"https://api.github.com/repos/ktoso/akka/pulls/4/comments","review_comment_url":"https://api.github.com/repos/ktoso/akka/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ktoso/akka/issues/4/comments","statuses_url":"https://api.github.com/repos/ktoso/akka/statuses/13ad2220bfa25ef4f1208ae077b7b215e387d2fc","head":{"label":"fsat:wip-json-parsing-stage-perf-tweaks-1","ref":"wip-json-parsing-stage-perf-tweaks-1","sha":"13ad2220bfa25ef4f1208ae077b7b215e387d2fc","user":{"login":"fsat","id":1665611,"avatar_url":"https://avatars.githubusercontent.com/u/1665611?v=3","gravatar_id":"","url":"https://api.github.com/users/fsat","html_url":"https://github.com/fsat","followers_url":"https://api.github.com/users/fsat/followers","following_url":"https://api.github.com/users/fsat/following{/other_user}","gists_url":"https://api.github.com/users/fsat/gists{/gist_id}","starred_url":"https://api.github.com/users/fsat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fsat/subscriptions","organizations_url":"https://api.github.com/users/fsat/orgs","repos_url":"https://api.github.com/users/fsat/repos","events_url":"https://api.github.com/users/fsat/events{/privacy}","received_events_url":"https://api.github.com/users/fsat/received_events","type":"User","site_admin":false},"repo":{"id":44372211,"name":"akka","full_name":"fsat/akka","owner":{"login":"fsat","id":1665611,"avatar_url":"https://avatars.githubusercontent.com/u/1665611?v=3","gravatar_id":"","url":"https://api.github.com/users/fsat","html_url":"https://github.com/fsat","followers_url":"https://api.github.com/users/fsat/followers","following_url":"https://api.github.com/users/fsat/following{/other_user}","gists_url":"https://api.github.com/users/fsat/gists{/gist_id}","starred_url":"https://api.github.com/users/fsat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fsat/subscriptions","organizations_url":"https://api.github.com/users/fsat/orgs","repos_url":"https://api.github.com/users/fsat/repos","events_url":"https://api.github.com/users/fsat/events{/privacy}","received_events_url":"https://api.github.com/users/fsat/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/fsat/akka","description":"Akka Project","fork":true,"url":"https://api.github.com/repos/fsat/akka","forks_url":"https://api.github.com/repos/fsat/akka/forks","keys_url":"https://api.github.com/repos/fsat/akka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fsat/akka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fsat/akka/teams","hooks_url":"https://api.github.com/repos/fsat/akka/hooks","issue_events_url":"https://api.github.com/repos/fsat/akka/issues/events{/number}","events_url":"https://api.github.com/repos/fsat/akka/events","assignees_url":"https://api.github.com/repos/fsat/akka/assignees{/user}","branches_url":"https://api.github.com/repos/fsat/akka/branches{/branch}","tags_url":"https://api.github.com/repos/fsat/akka/tags","blobs_url":"https://api.github.com/repos/fsat/akka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fsat/akka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fsat/akka/git/refs{/sha}","trees_url":"https://api.github.com/repos/fsat/akka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fsat/akka/statuses/{sha}","languages_url":"https://api.github.com/repos/fsat/akka/languages","stargazers_url":"https://api.github.com/repos/fsat/akka/stargazers","contributors_url":"https://api.github.com/repos/fsat/akka/contributors","subscribers_url":"https://api.github.com/repos/fsat/akka/subscribers","subscription_url":"https://api.github.com/repos/fsat/akka/subscription","commits_url":"https://api.github.com/repos/fsat/akka/commits{/sha}","git_commits_url":"https://api.github.com/repos/fsat/akka/git/commits{/sha}","comments_url":"https://api.github.com/repos/fsat/akka/comments{/number}","issue_comment_url":"https://api.github.com/repos/fsat/akka/issues/comments{/number}","contents_url":"https://api.github.com/repos/fsat/akka/contents/{+path}","compare_url":"https://api.github.com/repos/fsat/akka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fsat/akka/merges","archive_url":"https://api.github.com/repos/fsat/akka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fsat/akka/downloads","issues_url":"https://api.github.com/repos/fsat/akka/issues{/number}","pulls_url":"https://api.github.com/repos/fsat/akka/pulls{/number}","milestones_url":"https://api.github.com/repos/fsat/akka/milestones{/number}","notifications_url":"https://api.github.com/repos/fsat/akka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fsat/akka/labels{/name}","releases_url":"https://api.github.com/repos/fsat/akka/releases{/id}","created_at":"2015-10-16T08:24:35Z","updated_at":"2015-10-16T08:24:52Z","pushed_at":"2015-10-16T12:16:04Z","git_url":"git://github.com/fsat/akka.git","ssh_url":"git@github.com:fsat/akka.git","clone_url":"https://github.com/fsat/akka.git","svn_url":"https://github.com/fsat/akka","homepage":"http://akka.io","size":271580,"stargazers_count":0,"watchers_count":0,"language":"Scala","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":"ktoso:wip-json-thingies-ktoso","ref":"wip-json-thingies-ktoso","sha":"68a86d3a056e99e8d938d2238bd565764284a905","user":{"login":"ktoso","id":120979,"avatar_url":"https://avatars.githubusercontent.com/u/120979?v=3","gravatar_id":"","url":"https://api.github.com/users/ktoso","html_url":"https://github.com/ktoso","followers_url":"https://api.github.com/users/ktoso/followers","following_url":"https://api.github.com/users/ktoso/following{/other_user}","gists_url":"https://api.github.com/users/ktoso/gists{/gist_id}","starred_url":"https://api.github.com/users/ktoso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ktoso/subscriptions","organizations_url":"https://api.github.com/users/ktoso/orgs","repos_url":"https://api.github.com/users/ktoso/repos","events_url":"https://api.github.com/users/ktoso/events{/privacy}","received_events_url":"https://api.github.com/users/ktoso/received_events","type":"User","site_admin":false},"repo":{"id":4462204,"name":"akka","full_name":"ktoso/akka","owner":{"login":"ktoso","id":120979,"avatar_url":"https://avatars.githubusercontent.com/u/120979?v=3","gravatar_id":"","url":"https://api.github.com/users/ktoso","html_url":"https://github.com/ktoso","followers_url":"https://api.github.com/users/ktoso/followers","following_url":"https://api.github.com/users/ktoso/following{/other_user}","gists_url":"https://api.github.com/users/ktoso/gists{/gist_id}","starred_url":"https://api.github.com/users/ktoso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ktoso/subscriptions","organizations_url":"https://api.github.com/users/ktoso/orgs","repos_url":"https://api.github.com/users/ktoso/repos","events_url":"https://api.github.com/users/ktoso/events{/privacy}","received_events_url":"https://api.github.com/users/ktoso/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ktoso/akka","description":"Akka Project","fork":true,"url":"https://api.github.com/repos/ktoso/akka","forks_url":"https://api.github.com/repos/ktoso/akka/forks","keys_url":"https://api.github.com/repos/ktoso/akka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ktoso/akka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ktoso/akka/teams","hooks_url":"https://api.github.com/repos/ktoso/akka/hooks","issue_events_url":"https://api.github.com/repos/ktoso/akka/issues/events{/number}","events_url":"https://api.github.com/repos/ktoso/akka/events","assignees_url":"https://api.github.com/repos/ktoso/akka/assignees{/user}","branches_url":"https://api.github.com/repos/ktoso/akka/branches{/branch}","tags_url":"https://api.github.com/repos/ktoso/akka/tags","blobs_url":"https://api.github.com/repos/ktoso/akka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ktoso/akka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ktoso/akka/git/refs{/sha}","trees_url":"https://api.github.com/repos/ktoso/akka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ktoso/akka/statuses/{sha}","languages_url":"https://api.github.com/repos/ktoso/akka/languages","stargazers_url":"https://api.github.com/repos/ktoso/akka/stargazers","contributors_url":"https://api.github.com/repos/ktoso/akka/contributors","subscribers_url":"https://api.github.com/repos/ktoso/akka/subscribers","subscription_url":"https://api.github.com/repos/ktoso/akka/subscription","commits_url":"https://api.github.com/repos/ktoso/akka/commits{/sha}","git_commits_url":"https://api.github.com/repos/ktoso/akka/git/commits{/sha}","comments_url":"https://api.github.com/repos/ktoso/akka/comments{/number}","issue_comment_url":"https://api.github.com/repos/ktoso/akka/issues/comments{/number}","contents_url":"https://api.github.com/repos/ktoso/akka/contents/{+path}","compare_url":"https://api.github.com/repos/ktoso/akka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ktoso/akka/merges","archive_url":"https://api.github.com/repos/ktoso/akka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ktoso/akka/downloads","issues_url":"https://api.github.com/repos/ktoso/akka/issues{/number}","pulls_url":"https://api.github.com/repos/ktoso/akka/pulls{/number}","milestones_url":"https://api.github.com/repos/ktoso/akka/milestones{/number}","notifications_url":"https://api.github.com/repos/ktoso/akka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ktoso/akka/labels{/name}","releases_url":"https://api.github.com/repos/ktoso/akka/releases{/id}","created_at":"2012-05-27T14:05:17Z","updated_at":"2015-04-03T11:58:56Z","pushed_at":"2015-10-16T12:17:46Z","git_url":"git://github.com/ktoso/akka.git","ssh_url":"git@github.com:ktoso/akka.git","clone_url":"https://github.com/ktoso/akka.git","svn_url":"https://github.com/ktoso/akka","homepage":"http://akka.io","size":171377,"stargazers_count":1,"watchers_count":1,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ktoso/akka/pulls/4"},"html":{"href":"https://github.com/ktoso/akka/pull/4"},"issue":{"href":"https://api.github.com/repos/ktoso/akka/issues/4"},"comments":{"href":"https://api.github.com/repos/ktoso/akka/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/ktoso/akka/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/ktoso/akka/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ktoso/akka/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/ktoso/akka/statuses/13ad2220bfa25ef4f1208ae077b7b215e387d2fc"}}}}