{"action":"created","comment":{"url":"https://api.github.com/repos/CommBank/maestro/pulls/comments/28540908","id":28540908,"diff_hunk":"@@ -12,53 +12,141 @@\n //   See the License for the specific language governing permissions and\n //   limitations under the License.\n \n-package au.com.cba.omnia.maestro.benchmark\n-package codec\n+package au.com.cba.omnia.maestro.benchmark.codec\n \n-import au.com.cba.omnia.maestro.benchmark.thrift._\n-import au.com.cba.omnia.maestro.core.codec._\n-import au.com.cba.omnia.maestro.macros._\n+import java.io.Serializable\n \n-import scalaz._, Scalaz._\n+import au.com.cba.omnia.maestro.benchmark.thrift.{Struct10, Struct20, Struct30}\n+import au.com.cba.omnia.maestro.core.codec.{Encode, Decode}\n+import au.com.cba.omnia.maestro.macros.Macros\n \n-import org.scalameter.api._\n+import org.scalameter.api.{PerformanceTest, Gen}\n \n \n-object Data extends java.io.Serializable {\n-  implicit val BasicDecode: Decode[Basic] =\n-    Macros.mkDecode[Basic]\n+object Data extends Serializable {\n+  import Implicits._\n \n-  implicit val BasicEncode: Encode[Basic] =\n-    Macros.mkEncode[Basic]\n+  def mkStruct10Values(rows: Int): Array[Struct10] =\n+    (0 until rows).map(row => Struct10(\n+        s\"r$row-f0\", s\"r$row-f1\", s\"r$row-f2\", row * 10 + 3, Int.MaxValue + row * 10 + 4,\n+        s\"r$row-f5\", s\"r$row-f6\", s\"r$row-f7\", row * 10 + 8, Int.MaxValue + row * 10 + 9\n+    )).toArray\n \n-  def data(n: Int): List[Basic] = (1 to n).toList.map(n =>\n-    Basic(\"basic-\" + n, n, Int.MaxValue.toLong + n.toLong)\n-  )\n+  def mkStruct10Rows(rows: Int): Array[List[String]] =\n+    mkStruct10Values(rows).map(v => List(\n+      v._1, v._2, v._3, v._4.toString, v._5.toString,\n+      v._6, v._7, v._8, v._9.toString, v._10.toString\n+    ))\n \n-  def source(n: Int): List[DecodeSource] =\n-    data(n).map(d => ValDecodeSource(Encode.encode(d)))\n-}\n+  def mkStruct20Values(rows: Int): Array[Struct20] =\n+    (0 until rows).map(row => Struct20(\n+      s\"r$row-f0\",  s\"r$row-f1\",  s\"r$row-f2\",  row * 20 + 3,  Int.MaxValue + row * 10 + 4,\n+      s\"r$row-f5\",  s\"r$row-f6\",  s\"r$row-f7\",  row * 20 + 8,  Int.MaxValue + row * 10 + 9,\n+      s\"r$row-f10\", s\"r$row-f11\", s\"r$row-f12\", row * 20 + 13, Int.MaxValue + row * 10 + 14,\n+      s\"r$row-f15\", s\"r$row-f16\", s\"r$row-f17\", row * 20 + 18, Int.MaxValue + row * 10 + 19\n+    )).toArray\n \n-object CodecBenchmark extends PerformanceTest.Microbenchmark {\n-  import Data._\n+  def mkStruct20Rows(rows: Int): Array[List[String]] =\n+    mkStruct20Values(rows).map(v => List(\n+      v._1,  v._2,  v._3,  v._4.toString,  v._5.toString,\n+      v._6,  v._7,  v._8,  v._9.toString,  v._10.toString,\n+      v._11, v._12, v._13, v._14.toString, v._15.toString,\n+      v._16, v._17, v._18, v._19.toString, v._20.toString\n+    ))\n \n-  val sizes = Gen.range(\"size\")(10000, 20000, 10000)\n+  def mkStruct30Values(rows: Int): Array[Struct30] =\n+    (0 until rows).map(row => Struct30(\n+      s\"r$row-f0\",  s\"r$row-f1\",  s\"r$row-f2\",  row * 30 + 3,  Int.MaxValue + row * 10 + 4,\n+      s\"r$row-f5\",  s\"r$row-f6\",  s\"r$row-f7\",  row * 30 + 8,  Int.MaxValue + row * 10 + 9,\n+      s\"r$row-f10\", s\"r$row-f11\", s\"r$row-f12\", row * 30 + 13, Int.MaxValue + row * 10 + 14,\n+      s\"r$row-f15\", s\"r$row-f16\", s\"r$row-f17\", row * 30 + 18, Int.MaxValue + row * 10 + 19,\n+      s\"r$row-f20\", s\"r$row-f21\", s\"r$row-f22\", row * 30 + 23, Int.MaxValue + row * 10 + 24,\n+      s\"r$row-f25\", s\"r$row-f26\", s\"r$row-f27\", row * 30 + 28, Int.MaxValue + row * 10 + 29\n+    )).toArray\n \n-  val toEncode = sizes.map(data(_))\n+  def mkStruct30Rows(rows: Int): Array[List[String]] =\n+    mkStruct30Values(rows).map(v => List(\n+      v._1,  v._2,  v._3,  v._4.toString,  v._5.toString,\n+      v._6,  v._7,  v._8,  v._9.toString,  v._10.toString,\n+      v._11, v._12, v._13, v._14.toString, v._15.toString,\n+      v._16, v._17, v._18, v._19.toString, v._20.toString,\n+      v._21, v._22, v._23, v._24.toString, v._25.toString,\n+      v._26, v._27, v._28, v._29.toString, v._30.toString\n+    ))\n \n-  val toDecode = sizes.map(source(_))\n+  val rows           = Gen.range(\"rows\")(10000, 30000, 10000)\n+  val struct10Values = rows.map(mkStruct10Values(_))\n+  val struct10Rows   = rows.map(mkStruct10Rows(_))\n+  val struct20Values = rows.map(mkStruct20Values(_))\n+  val struct20Rows   = rows.map(mkStruct20Rows(_))\n+  val struct30Values = rows.map(mkStruct30Values(_))\n+  val struct30Rows   = rows.map(mkStruct30Rows(_))\n+}\n \n-  performance of \"Codecs\" in {\n-    measure method \"encode\" in {\n-      using(toEncode) in { e =>\n-        e.map(b => Encode.encode(b))\n+object CodecBenchmark extends PerformanceTest.OfflineReport {\n+  import Implicits._\n+\n+  def testDecode[A : Decode](rows: Gen[Array[List[String]]]) =\n+    using(rows) in { rows => {\n+      var i = 0","path":"maestro-benchmark/src/test/scala/au/com/cba/omnia/maestro/benchmark/codec/CodecBenchmark.scala","position":107,"original_position":107,"commit_id":"970b4db5c9163b6f13c437eefdc68711833d89aa","original_commit_id":"970b4db5c9163b6f13c437eefdc68711833d89aa","user":{"login":"stephanh","id":376868,"avatar_url":"https://avatars.githubusercontent.com/u/376868?v=3","gravatar_id":"","url":"https://api.github.com/users/stephanh","html_url":"https://github.com/stephanh","followers_url":"https://api.github.com/users/stephanh/followers","following_url":"https://api.github.com/users/stephanh/following{/other_user}","gists_url":"https://api.github.com/users/stephanh/gists{/gist_id}","starred_url":"https://api.github.com/users/stephanh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephanh/subscriptions","organizations_url":"https://api.github.com/users/stephanh/orgs","repos_url":"https://api.github.com/users/stephanh/repos","events_url":"https://api.github.com/users/stephanh/events{/privacy}","received_events_url":"https://api.github.com/users/stephanh/received_events","type":"User","site_admin":false},"body":"![Codacy](https://www.codacy.com/versioned/images/favicon.png) Issue found: [Avoid mutable local variables](https://www.codacy.com/app/CommBank/maestro/file/489016064/issues/source?bid=2205397&fileBranchId=2253658#l91)","created_at":"2015-04-16T19:20:07Z","updated_at":"2015-04-16T19:20:07Z","html_url":"https://github.com/CommBank/maestro/pull/368#discussion_r28540908","pull_request_url":"https://api.github.com/repos/CommBank/maestro/pulls/368","_links":{"self":{"href":"https://api.github.com/repos/CommBank/maestro/pulls/comments/28540908"},"html":{"href":"https://github.com/CommBank/maestro/pull/368#discussion_r28540908"},"pull_request":{"href":"https://api.github.com/repos/CommBank/maestro/pulls/368"}}},"pull_request":{"url":"https://api.github.com/repos/CommBank/maestro/pulls/368","id":33453125,"html_url":"https://github.com/CommBank/maestro/pull/368","diff_url":"https://github.com/CommBank/maestro/pull/368.diff","patch_url":"https://github.com/CommBank/maestro/pull/368.patch","issue_url":"https://api.github.com/repos/CommBank/maestro/issues/368","number":368,"state":"open","locked":false,"title":"benchmark project","user":{"login":"SamRoberts","id":1086978,"avatar_url":"https://avatars.githubusercontent.com/u/1086978?v=3","gravatar_id":"","url":"https://api.github.com/users/SamRoberts","html_url":"https://github.com/SamRoberts","followers_url":"https://api.github.com/users/SamRoberts/followers","following_url":"https://api.github.com/users/SamRoberts/following{/other_user}","gists_url":"https://api.github.com/users/SamRoberts/gists{/gist_id}","starred_url":"https://api.github.com/users/SamRoberts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SamRoberts/subscriptions","organizations_url":"https://api.github.com/users/SamRoberts/orgs","repos_url":"https://api.github.com/users/SamRoberts/repos","events_url":"https://api.github.com/users/SamRoberts/events{/privacy}","received_events_url":"https://api.github.com/users/SamRoberts/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-04-16T13:57:45Z","updated_at":"2015-04-16T19:20:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5c453c726e5ed76545a7ea9ecc6127ab6e458f60","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/CommBank/maestro/pulls/368/commits","review_comments_url":"https://api.github.com/repos/CommBank/maestro/pulls/368/comments","review_comment_url":"https://api.github.com/repos/CommBank/maestro/pulls/comments{/number}","comments_url":"https://api.github.com/repos/CommBank/maestro/issues/368/comments","statuses_url":"https://api.github.com/repos/CommBank/maestro/statuses/970b4db5c9163b6f13c437eefdc68711833d89aa","head":{"label":"CommBank:sam_benchmark","ref":"sam_benchmark","sha":"970b4db5c9163b6f13c437eefdc68711833d89aa","user":{"login":"CommBank","id":4240076,"avatar_url":"https://avatars.githubusercontent.com/u/4240076?v=3","gravatar_id":"","url":"https://api.github.com/users/CommBank","html_url":"https://github.com/CommBank","followers_url":"https://api.github.com/users/CommBank/followers","following_url":"https://api.github.com/users/CommBank/following{/other_user}","gists_url":"https://api.github.com/users/CommBank/gists{/gist_id}","starred_url":"https://api.github.com/users/CommBank/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CommBank/subscriptions","organizations_url":"https://api.github.com/users/CommBank/orgs","repos_url":"https://api.github.com/users/CommBank/repos","events_url":"https://api.github.com/users/CommBank/events{/privacy}","received_events_url":"https://api.github.com/users/CommBank/received_events","type":"Organization","site_admin":false},"repo":{"id":17347463,"name":"maestro","full_name":"CommBank/maestro","owner":{"login":"CommBank","id":4240076,"avatar_url":"https://avatars.githubusercontent.com/u/4240076?v=3","gravatar_id":"","url":"https://api.github.com/users/CommBank","html_url":"https://github.com/CommBank","followers_url":"https://api.github.com/users/CommBank/followers","following_url":"https://api.github.com/users/CommBank/following{/other_user}","gists_url":"https://api.github.com/users/CommBank/gists{/gist_id}","starred_url":"https://api.github.com/users/CommBank/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CommBank/subscriptions","organizations_url":"https://api.github.com/users/CommBank/orgs","repos_url":"https://api.github.com/users/CommBank/repos","events_url":"https://api.github.com/users/CommBank/events{/privacy}","received_events_url":"https://api.github.com/users/CommBank/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CommBank/maestro","description":"Data Pipelines that are well typed and enforce good convention","fork":false,"url":"https://api.github.com/repos/CommBank/maestro","forks_url":"https://api.github.com/repos/CommBank/maestro/forks","keys_url":"https://api.github.com/repos/CommBank/maestro/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CommBank/maestro/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CommBank/maestro/teams","hooks_url":"https://api.github.com/repos/CommBank/maestro/hooks","issue_events_url":"https://api.github.com/repos/CommBank/maestro/issues/events{/number}","events_url":"https://api.github.com/repos/CommBank/maestro/events","assignees_url":"https://api.github.com/repos/CommBank/maestro/assignees{/user}","branches_url":"https://api.github.com/repos/CommBank/maestro/branches{/branch}","tags_url":"https://api.github.com/repos/CommBank/maestro/tags","blobs_url":"https://api.github.com/repos/CommBank/maestro/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CommBank/maestro/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CommBank/maestro/git/refs{/sha}","trees_url":"https://api.github.com/repos/CommBank/maestro/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CommBank/maestro/statuses/{sha}","languages_url":"https://api.github.com/repos/CommBank/maestro/languages","stargazers_url":"https://api.github.com/repos/CommBank/maestro/stargazers","contributors_url":"https://api.github.com/repos/CommBank/maestro/contributors","subscribers_url":"https://api.github.com/repos/CommBank/maestro/subscribers","subscription_url":"https://api.github.com/repos/CommBank/maestro/subscription","commits_url":"https://api.github.com/repos/CommBank/maestro/commits{/sha}","git_commits_url":"https://api.github.com/repos/CommBank/maestro/git/commits{/sha}","comments_url":"https://api.github.com/repos/CommBank/maestro/comments{/number}","issue_comment_url":"https://api.github.com/repos/CommBank/maestro/issues/comments{/number}","contents_url":"https://api.github.com/repos/CommBank/maestro/contents/{+path}","compare_url":"https://api.github.com/repos/CommBank/maestro/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CommBank/maestro/merges","archive_url":"https://api.github.com/repos/CommBank/maestro/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CommBank/maestro/downloads","issues_url":"https://api.github.com/repos/CommBank/maestro/issues{/number}","pulls_url":"https://api.github.com/repos/CommBank/maestro/pulls{/number}","milestones_url":"https://api.github.com/repos/CommBank/maestro/milestones{/number}","notifications_url":"https://api.github.com/repos/CommBank/maestro/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CommBank/maestro/labels{/name}","releases_url":"https://api.github.com/repos/CommBank/maestro/releases{/id}","created_at":"2014-03-02T21:34:53Z","updated_at":"2015-04-16T05:01:01Z","pushed_at":"2015-04-16T14:16:01Z","git_url":"git://github.com/CommBank/maestro.git","ssh_url":"git@github.com:CommBank/maestro.git","clone_url":"https://github.com/CommBank/maestro.git","svn_url":"https://github.com/CommBank/maestro","homepage":"https://commbank.github.io/maestro","size":45026,"stargazers_count":26,"watchers_count":26,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":16,"mirror_url":null,"open_issues_count":52,"forks":16,"open_issues":52,"watchers":26,"default_branch":"master"}},"base":{"label":"CommBank:master","ref":"master","sha":"0fdf42738f90c89897cc8cf621ae7f8e5e36a228","user":{"login":"CommBank","id":4240076,"avatar_url":"https://avatars.githubusercontent.com/u/4240076?v=3","gravatar_id":"","url":"https://api.github.com/users/CommBank","html_url":"https://github.com/CommBank","followers_url":"https://api.github.com/users/CommBank/followers","following_url":"https://api.github.com/users/CommBank/following{/other_user}","gists_url":"https://api.github.com/users/CommBank/gists{/gist_id}","starred_url":"https://api.github.com/users/CommBank/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CommBank/subscriptions","organizations_url":"https://api.github.com/users/CommBank/orgs","repos_url":"https://api.github.com/users/CommBank/repos","events_url":"https://api.github.com/users/CommBank/events{/privacy}","received_events_url":"https://api.github.com/users/CommBank/received_events","type":"Organization","site_admin":false},"repo":{"id":17347463,"name":"maestro","full_name":"CommBank/maestro","owner":{"login":"CommBank","id":4240076,"avatar_url":"https://avatars.githubusercontent.com/u/4240076?v=3","gravatar_id":"","url":"https://api.github.com/users/CommBank","html_url":"https://github.com/CommBank","followers_url":"https://api.github.com/users/CommBank/followers","following_url":"https://api.github.com/users/CommBank/following{/other_user}","gists_url":"https://api.github.com/users/CommBank/gists{/gist_id}","starred_url":"https://api.github.com/users/CommBank/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CommBank/subscriptions","organizations_url":"https://api.github.com/users/CommBank/orgs","repos_url":"https://api.github.com/users/CommBank/repos","events_url":"https://api.github.com/users/CommBank/events{/privacy}","received_events_url":"https://api.github.com/users/CommBank/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CommBank/maestro","description":"Data Pipelines that are well typed and enforce good convention","fork":false,"url":"https://api.github.com/repos/CommBank/maestro","forks_url":"https://api.github.com/repos/CommBank/maestro/forks","keys_url":"https://api.github.com/repos/CommBank/maestro/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CommBank/maestro/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CommBank/maestro/teams","hooks_url":"https://api.github.com/repos/CommBank/maestro/hooks","issue_events_url":"https://api.github.com/repos/CommBank/maestro/issues/events{/number}","events_url":"https://api.github.com/repos/CommBank/maestro/events","assignees_url":"https://api.github.com/repos/CommBank/maestro/assignees{/user}","branches_url":"https://api.github.com/repos/CommBank/maestro/branches{/branch}","tags_url":"https://api.github.com/repos/CommBank/maestro/tags","blobs_url":"https://api.github.com/repos/CommBank/maestro/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CommBank/maestro/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CommBank/maestro/git/refs{/sha}","trees_url":"https://api.github.com/repos/CommBank/maestro/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CommBank/maestro/statuses/{sha}","languages_url":"https://api.github.com/repos/CommBank/maestro/languages","stargazers_url":"https://api.github.com/repos/CommBank/maestro/stargazers","contributors_url":"https://api.github.com/repos/CommBank/maestro/contributors","subscribers_url":"https://api.github.com/repos/CommBank/maestro/subscribers","subscription_url":"https://api.github.com/repos/CommBank/maestro/subscription","commits_url":"https://api.github.com/repos/CommBank/maestro/commits{/sha}","git_commits_url":"https://api.github.com/repos/CommBank/maestro/git/commits{/sha}","comments_url":"https://api.github.com/repos/CommBank/maestro/comments{/number}","issue_comment_url":"https://api.github.com/repos/CommBank/maestro/issues/comments{/number}","contents_url":"https://api.github.com/repos/CommBank/maestro/contents/{+path}","compare_url":"https://api.github.com/repos/CommBank/maestro/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CommBank/maestro/merges","archive_url":"https://api.github.com/repos/CommBank/maestro/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CommBank/maestro/downloads","issues_url":"https://api.github.com/repos/CommBank/maestro/issues{/number}","pulls_url":"https://api.github.com/repos/CommBank/maestro/pulls{/number}","milestones_url":"https://api.github.com/repos/CommBank/maestro/milestones{/number}","notifications_url":"https://api.github.com/repos/CommBank/maestro/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CommBank/maestro/labels{/name}","releases_url":"https://api.github.com/repos/CommBank/maestro/releases{/id}","created_at":"2014-03-02T21:34:53Z","updated_at":"2015-04-16T05:01:01Z","pushed_at":"2015-04-16T14:16:01Z","git_url":"git://github.com/CommBank/maestro.git","ssh_url":"git@github.com:CommBank/maestro.git","clone_url":"https://github.com/CommBank/maestro.git","svn_url":"https://github.com/CommBank/maestro","homepage":"https://commbank.github.io/maestro","size":45026,"stargazers_count":26,"watchers_count":26,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":16,"mirror_url":null,"open_issues_count":52,"forks":16,"open_issues":52,"watchers":26,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/CommBank/maestro/pulls/368"},"html":{"href":"https://github.com/CommBank/maestro/pull/368"},"issue":{"href":"https://api.github.com/repos/CommBank/maestro/issues/368"},"comments":{"href":"https://api.github.com/repos/CommBank/maestro/issues/368/comments"},"review_comments":{"href":"https://api.github.com/repos/CommBank/maestro/pulls/368/comments"},"review_comment":{"href":"https://api.github.com/repos/CommBank/maestro/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/CommBank/maestro/pulls/368/commits"},"statuses":{"href":"https://api.github.com/repos/CommBank/maestro/statuses/970b4db5c9163b6f13c437eefdc68711833d89aa"}}}}