{"action":"created","comment":{"url":"https://api.github.com/repos/Jijka/Scala-complete-course/pulls/comments/219705079","pull_request_review_id":157945448,"id":219705079,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxOTcwNTA3OQ==","diff_hunk":"@@ -10,51 +17,73 @@ import lectures.functions.Data\n   * отличаются друг от друга по производительности\n   *\n   * Для этого\n-  *   * в классах CurriedComputation и FunctionalComputation уберите extends App, оставьте extends Data\n-  *   * раскомментируйте код, выполните в циклах вызов 3-х имплементаций,\n-  *   * оцените разницу во времени выполнения и объясните ее происхожение\n+  * * в классах CurriedComputation и FunctionalComputation уберите extends App, оставьте extends Data\n+  * * раскомментируйте код, выполните в циклах вызов 3-х имплементаций,\n+  * * оцените разницу во времени выполнения и объясните ее происхожение\n   *\n   */\n object EvaluateOptimization extends App with Data {\n \n-  val computationStartTimestamp = System.currentTimeMillis()\n-\n-//  // ВЫПОЛНИТЬ В ЦИКЛЕ ОТ 1 ДО 100 Computation.computation\n-//  for (??? <- ???) {\n-//    ???\n-//  }\n-//\n-//  println(\"Elapsed time in computation(): \" + (System.currentTimeMillis() - computationStartTimestamp))\n-//\n-//\n-//\n-//  val partiallyAppliedStartTimestamp = System.currentTimeMillis()\n-//\n-//  // ВЫПОЛНИТЬ В ЦИКЛЕ ОТ 1 ДО 100 CurriedComputation.partiallyAppliedCurriedFunction\n-//  for (??? <- ???) {\n-//    ???\n-//  }\n-//\n-//  val partiallyAppliedDuration = System.currentTimeMillis() - partiallyAppliedStartTimestamp\n-//  println(\"Elapsed time in partiallyAppliedCurriedFunction(): \" + partiallyAppliedDuration)\n-//\n-//\n-//\n-//  val filterAppliedStartTimestamp = System.currentTimeMillis()\n-//\n-//  // ВЫПОЛНИТЬ В ЦИКЛЕ ОТ 1 ДО 100 FunctionalComputation.filterApplied\n-//  for (??? <- ???) {\n-//    ???\n-//  }\n-//\n-//  val filterAppliedDuration = System.currentTimeMillis() - filterAppliedStartTimestamp\n-//  println(\"Elapsed time in filterApplied():\" + filterAppliedDuration)\n-//\n-//  // ВЫВЕСТИ РАЗНИЦУ В ПРОДОЛЖИТЕЛЬНОСТИ ВЫПОЛНЕНИЯ МЕЖДУ КАРРИРОВАННОЙ ВЕРСИЕЙ\n-//  // И ФУНКЦИОНАЛЬНОЙ\n-//\n-//  val diff = ???\n-//\n-//  println(s\"Difference is about $diff milliseconds\")\n-}\n+  case class Times(count: Int)\n+\n+  def time[T](timeFunction: () => Long)(f: => T)(\n+      implicit c: Times = Times(1)): Long = {\n+    val computationStartTimestamp = timeFunction()\n+    for (_ <- 1 to c.count) { f }\n+    val endTime = timeFunction()\n+    val elapsedTime = endTime - computationStartTimestamp\n+    println(\n+      s\"Elapsed time in computation(): $elapsedTime ms $computationStartTimestamp $endTime\")\n+    elapsedTime\n+  }\n+\n+  implicit val times: Times = Times(10)","path":"src/main/scala/lectures/operators/EvaluateOptimization.scala","position":82,"original_position":82,"commit_id":"6c8560e9744c95b4d805719e11563fc93d630e71","original_commit_id":"6c8560e9744c95b4d805719e11563fc93d630e71","user":{"login":"aliksz","id":5522718,"node_id":"MDQ6VXNlcjU1MjI3MTg=","avatar_url":"https://avatars0.githubusercontent.com/u/5522718?v=4","gravatar_id":"","url":"https://api.github.com/users/aliksz","html_url":"https://github.com/aliksz","followers_url":"https://api.github.com/users/aliksz/followers","following_url":"https://api.github.com/users/aliksz/following{/other_user}","gists_url":"https://api.github.com/users/aliksz/gists{/gist_id}","starred_url":"https://api.github.com/users/aliksz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aliksz/subscriptions","organizations_url":"https://api.github.com/users/aliksz/orgs","repos_url":"https://api.github.com/users/aliksz/repos","events_url":"https://api.github.com/users/aliksz/events{/privacy}","received_events_url":"https://api.github.com/users/aliksz/received_events","type":"User","site_admin":false},"body":"поставь 100 или 1000","created_at":"2018-09-23T17:10:24Z","updated_at":"2018-09-23T17:15:29Z","html_url":"https://github.com/Jijka/Scala-complete-course/pull/3#discussion_r219705079","pull_request_url":"https://api.github.com/repos/Jijka/Scala-complete-course/pulls/3","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/Jijka/Scala-complete-course/pulls/comments/219705079"},"html":{"href":"https://github.com/Jijka/Scala-complete-course/pull/3#discussion_r219705079"},"pull_request":{"href":"https://api.github.com/repos/Jijka/Scala-complete-course/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/Jijka/Scala-complete-course/pulls/3","id":215940864,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE1OTQwODY0","html_url":"https://github.com/Jijka/Scala-complete-course/pull/3","diff_url":"https://github.com/Jijka/Scala-complete-course/pull/3.diff","patch_url":"https://github.com/Jijka/Scala-complete-course/pull/3.patch","issue_url":"https://api.github.com/repos/Jijka/Scala-complete-course/issues/3","number":3,"state":"open","locked":false,"title":"Home work","user":{"login":"Jijka","id":11795372,"node_id":"MDQ6VXNlcjExNzk1Mzcy","avatar_url":"https://avatars0.githubusercontent.com/u/11795372?v=4","gravatar_id":"","url":"https://api.github.com/users/Jijka","html_url":"https://github.com/Jijka","followers_url":"https://api.github.com/users/Jijka/followers","following_url":"https://api.github.com/users/Jijka/following{/other_user}","gists_url":"https://api.github.com/users/Jijka/gists{/gist_id}","starred_url":"https://api.github.com/users/Jijka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jijka/subscriptions","organizations_url":"https://api.github.com/users/Jijka/orgs","repos_url":"https://api.github.com/users/Jijka/repos","events_url":"https://api.github.com/users/Jijka/events{/privacy}","received_events_url":"https://api.github.com/users/Jijka/received_events","type":"User","site_admin":false},"body":"Не очень понял  правильно ли сделал задание lectures.operators.EvaluateOptimization \r\nНужно ли убирать тред слип?\r\nПочему то очень быстро всё считается, правильно ли я сделал чтобы передать f как called-by-name?","created_at":"2018-09-17T10:52:15Z","updated_at":"2018-09-23T17:15:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"885fc0dced8c9a0fbef77bccb5ff62c202e825ab","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/Jijka/Scala-complete-course/pulls/3/commits","review_comments_url":"https://api.github.com/repos/Jijka/Scala-complete-course/pulls/3/comments","review_comment_url":"https://api.github.com/repos/Jijka/Scala-complete-course/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Jijka/Scala-complete-course/issues/3/comments","statuses_url":"https://api.github.com/repos/Jijka/Scala-complete-course/statuses/6c8560e9744c95b4d805719e11563fc93d630e71","head":{"label":"Jijka:HomeWork","ref":"HomeWork","sha":"6c8560e9744c95b4d805719e11563fc93d630e71","user":{"login":"Jijka","id":11795372,"node_id":"MDQ6VXNlcjExNzk1Mzcy","avatar_url":"https://avatars0.githubusercontent.com/u/11795372?v=4","gravatar_id":"","url":"https://api.github.com/users/Jijka","html_url":"https://github.com/Jijka","followers_url":"https://api.github.com/users/Jijka/followers","following_url":"https://api.github.com/users/Jijka/following{/other_user}","gists_url":"https://api.github.com/users/Jijka/gists{/gist_id}","starred_url":"https://api.github.com/users/Jijka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jijka/subscriptions","organizations_url":"https://api.github.com/users/Jijka/orgs","repos_url":"https://api.github.com/users/Jijka/repos","events_url":"https://api.github.com/users/Jijka/events{/privacy}","received_events_url":"https://api.github.com/users/Jijka/received_events","type":"User","site_admin":false},"repo":{"id":147638044,"node_id":"MDEwOlJlcG9zaXRvcnkxNDc2MzgwNDQ=","name":"Scala-complete-course","full_name":"Jijka/Scala-complete-course","private":false,"owner":{"login":"Jijka","id":11795372,"node_id":"MDQ6VXNlcjExNzk1Mzcy","avatar_url":"https://avatars0.githubusercontent.com/u/11795372?v=4","gravatar_id":"","url":"https://api.github.com/users/Jijka","html_url":"https://github.com/Jijka","followers_url":"https://api.github.com/users/Jijka/followers","following_url":"https://api.github.com/users/Jijka/following{/other_user}","gists_url":"https://api.github.com/users/Jijka/gists{/gist_id}","starred_url":"https://api.github.com/users/Jijka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jijka/subscriptions","organizations_url":"https://api.github.com/users/Jijka/orgs","repos_url":"https://api.github.com/users/Jijka/repos","events_url":"https://api.github.com/users/Jijka/events{/privacy}","received_events_url":"https://api.github.com/users/Jijka/received_events","type":"User","site_admin":false},"html_url":"https://github.com/Jijka/Scala-complete-course","description":"Full scala 1.5 year scala course ","fork":true,"url":"https://api.github.com/repos/Jijka/Scala-complete-course","forks_url":"https://api.github.com/repos/Jijka/Scala-complete-course/forks","keys_url":"https://api.github.com/repos/Jijka/Scala-complete-course/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Jijka/Scala-complete-course/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Jijka/Scala-complete-course/teams","hooks_url":"https://api.github.com/repos/Jijka/Scala-complete-course/hooks","issue_events_url":"https://api.github.com/repos/Jijka/Scala-complete-course/issues/events{/number}","events_url":"https://api.github.com/repos/Jijka/Scala-complete-course/events","assignees_url":"https://api.github.com/repos/Jijka/Scala-complete-course/assignees{/user}","branches_url":"https://api.github.com/repos/Jijka/Scala-complete-course/branches{/branch}","tags_url":"https://api.github.com/repos/Jijka/Scala-complete-course/tags","blobs_url":"https://api.github.com/repos/Jijka/Scala-complete-course/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Jijka/Scala-complete-course/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Jijka/Scala-complete-course/git/refs{/sha}","trees_url":"https://api.github.com/repos/Jijka/Scala-complete-course/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Jijka/Scala-complete-course/statuses/{sha}","languages_url":"https://api.github.com/repos/Jijka/Scala-complete-course/languages","stargazers_url":"https://api.github.com/repos/Jijka/Scala-complete-course/stargazers","contributors_url":"https://api.github.com/repos/Jijka/Scala-complete-course/contributors","subscribers_url":"https://api.github.com/repos/Jijka/Scala-complete-course/subscribers","subscription_url":"https://api.github.com/repos/Jijka/Scala-complete-course/subscription","commits_url":"https://api.github.com/repos/Jijka/Scala-complete-course/commits{/sha}","git_commits_url":"https://api.github.com/repos/Jijka/Scala-complete-course/git/commits{/sha}","comments_url":"https://api.github.com/repos/Jijka/Scala-complete-course/comments{/number}","issue_comment_url":"https://api.github.com/repos/Jijka/Scala-complete-course/issues/comments{/number}","contents_url":"https://api.github.com/repos/Jijka/Scala-complete-course/contents/{+path}","compare_url":"https://api.github.com/repos/Jijka/Scala-complete-course/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Jijka/Scala-complete-course/merges","archive_url":"https://api.github.com/repos/Jijka/Scala-complete-course/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Jijka/Scala-complete-course/downloads","issues_url":"https://api.github.com/repos/Jijka/Scala-complete-course/issues{/number}","pulls_url":"https://api.github.com/repos/Jijka/Scala-complete-course/pulls{/number}","milestones_url":"https://api.github.com/repos/Jijka/Scala-complete-course/milestones{/number}","notifications_url":"https://api.github.com/repos/Jijka/Scala-complete-course/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Jijka/Scala-complete-course/labels{/name}","releases_url":"https://api.github.com/repos/Jijka/Scala-complete-course/releases{/id}","deployments_url":"https://api.github.com/repos/Jijka/Scala-complete-course/deployments","created_at":"2018-09-06T07:55:20Z","updated_at":"2018-09-17T08:49:08Z","pushed_at":"2018-09-19T14:25:08Z","git_url":"git://github.com/Jijka/Scala-complete-course.git","ssh_url":"git@github.com:Jijka/Scala-complete-course.git","clone_url":"https://github.com/Jijka/Scala-complete-course.git","svn_url":"https://github.com/Jijka/Scala-complete-course","homepage":null,"size":42787,"stargazers_count":0,"watchers_count":0,"language":"Scala","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":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"Jijka:master","ref":"master","sha":"6f21b08e1a92c6a16872f3d85c5326a320d1e1f6","user":{"login":"Jijka","id":11795372,"node_id":"MDQ6VXNlcjExNzk1Mzcy","avatar_url":"https://avatars0.githubusercontent.com/u/11795372?v=4","gravatar_id":"","url":"https://api.github.com/users/Jijka","html_url":"https://github.com/Jijka","followers_url":"https://api.github.com/users/Jijka/followers","following_url":"https://api.github.com/users/Jijka/following{/other_user}","gists_url":"https://api.github.com/users/Jijka/gists{/gist_id}","starred_url":"https://api.github.com/users/Jijka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jijka/subscriptions","organizations_url":"https://api.github.com/users/Jijka/orgs","repos_url":"https://api.github.com/users/Jijka/repos","events_url":"https://api.github.com/users/Jijka/events{/privacy}","received_events_url":"https://api.github.com/users/Jijka/received_events","type":"User","site_admin":false},"repo":{"id":147638044,"node_id":"MDEwOlJlcG9zaXRvcnkxNDc2MzgwNDQ=","name":"Scala-complete-course","full_name":"Jijka/Scala-complete-course","private":false,"owner":{"login":"Jijka","id":11795372,"node_id":"MDQ6VXNlcjExNzk1Mzcy","avatar_url":"https://avatars0.githubusercontent.com/u/11795372?v=4","gravatar_id":"","url":"https://api.github.com/users/Jijka","html_url":"https://github.com/Jijka","followers_url":"https://api.github.com/users/Jijka/followers","following_url":"https://api.github.com/users/Jijka/following{/other_user}","gists_url":"https://api.github.com/users/Jijka/gists{/gist_id}","starred_url":"https://api.github.com/users/Jijka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jijka/subscriptions","organizations_url":"https://api.github.com/users/Jijka/orgs","repos_url":"https://api.github.com/users/Jijka/repos","events_url":"https://api.github.com/users/Jijka/events{/privacy}","received_events_url":"https://api.github.com/users/Jijka/received_events","type":"User","site_admin":false},"html_url":"https://github.com/Jijka/Scala-complete-course","description":"Full scala 1.5 year scala course ","fork":true,"url":"https://api.github.com/repos/Jijka/Scala-complete-course","forks_url":"https://api.github.com/repos/Jijka/Scala-complete-course/forks","keys_url":"https://api.github.com/repos/Jijka/Scala-complete-course/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Jijka/Scala-complete-course/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Jijka/Scala-complete-course/teams","hooks_url":"https://api.github.com/repos/Jijka/Scala-complete-course/hooks","issue_events_url":"https://api.github.com/repos/Jijka/Scala-complete-course/issues/events{/number}","events_url":"https://api.github.com/repos/Jijka/Scala-complete-course/events","assignees_url":"https://api.github.com/repos/Jijka/Scala-complete-course/assignees{/user}","branches_url":"https://api.github.com/repos/Jijka/Scala-complete-course/branches{/branch}","tags_url":"https://api.github.com/repos/Jijka/Scala-complete-course/tags","blobs_url":"https://api.github.com/repos/Jijka/Scala-complete-course/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Jijka/Scala-complete-course/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Jijka/Scala-complete-course/git/refs{/sha}","trees_url":"https://api.github.com/repos/Jijka/Scala-complete-course/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Jijka/Scala-complete-course/statuses/{sha}","languages_url":"https://api.github.com/repos/Jijka/Scala-complete-course/languages","stargazers_url":"https://api.github.com/repos/Jijka/Scala-complete-course/stargazers","contributors_url":"https://api.github.com/repos/Jijka/Scala-complete-course/contributors","subscribers_url":"https://api.github.com/repos/Jijka/Scala-complete-course/subscribers","subscription_url":"https://api.github.com/repos/Jijka/Scala-complete-course/subscription","commits_url":"https://api.github.com/repos/Jijka/Scala-complete-course/commits{/sha}","git_commits_url":"https://api.github.com/repos/Jijka/Scala-complete-course/git/commits{/sha}","comments_url":"https://api.github.com/repos/Jijka/Scala-complete-course/comments{/number}","issue_comment_url":"https://api.github.com/repos/Jijka/Scala-complete-course/issues/comments{/number}","contents_url":"https://api.github.com/repos/Jijka/Scala-complete-course/contents/{+path}","compare_url":"https://api.github.com/repos/Jijka/Scala-complete-course/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Jijka/Scala-complete-course/merges","archive_url":"https://api.github.com/repos/Jijka/Scala-complete-course/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Jijka/Scala-complete-course/downloads","issues_url":"https://api.github.com/repos/Jijka/Scala-complete-course/issues{/number}","pulls_url":"https://api.github.com/repos/Jijka/Scala-complete-course/pulls{/number}","milestones_url":"https://api.github.com/repos/Jijka/Scala-complete-course/milestones{/number}","notifications_url":"https://api.github.com/repos/Jijka/Scala-complete-course/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Jijka/Scala-complete-course/labels{/name}","releases_url":"https://api.github.com/repos/Jijka/Scala-complete-course/releases{/id}","deployments_url":"https://api.github.com/repos/Jijka/Scala-complete-course/deployments","created_at":"2018-09-06T07:55:20Z","updated_at":"2018-09-17T08:49:08Z","pushed_at":"2018-09-19T14:25:08Z","git_url":"git://github.com/Jijka/Scala-complete-course.git","ssh_url":"git@github.com:Jijka/Scala-complete-course.git","clone_url":"https://github.com/Jijka/Scala-complete-course.git","svn_url":"https://github.com/Jijka/Scala-complete-course","homepage":null,"size":42787,"stargazers_count":0,"watchers_count":0,"language":"Scala","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":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Jijka/Scala-complete-course/pulls/3"},"html":{"href":"https://github.com/Jijka/Scala-complete-course/pull/3"},"issue":{"href":"https://api.github.com/repos/Jijka/Scala-complete-course/issues/3"},"comments":{"href":"https://api.github.com/repos/Jijka/Scala-complete-course/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/Jijka/Scala-complete-course/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/Jijka/Scala-complete-course/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Jijka/Scala-complete-course/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/Jijka/Scala-complete-course/statuses/6c8560e9744c95b4d805719e11563fc93d630e71"}},"author_association":"OWNER"}}
{"actor":{"display_login":"aliksz"}}