{"action":"created","issue":{"url":"https://api.github.com/repos/functional-streams-for-scala/fs2/issues/1296","repository_url":"https://api.github.com/repos/functional-streams-for-scala/fs2","labels_url":"https://api.github.com/repos/functional-streams-for-scala/fs2/issues/1296/labels{/name}","comments_url":"https://api.github.com/repos/functional-streams-for-scala/fs2/issues/1296/comments","events_url":"https://api.github.com/repos/functional-streams-for-scala/fs2/issues/1296/events","html_url":"https://github.com/functional-streams-for-scala/fs2/pull/1296","id":372348455,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI0NTYzMzY5","number":1296,"title":"Dequeue1 performance","user":{"login":"maphi","id":9135719,"node_id":"MDQ6VXNlcjkxMzU3MTk=","avatar_url":"https://avatars3.githubusercontent.com/u/9135719?v=4","gravatar_id":"","url":"https://api.github.com/users/maphi","html_url":"https://github.com/maphi","followers_url":"https://api.github.com/users/maphi/followers","following_url":"https://api.github.com/users/maphi/following{/other_user}","gists_url":"https://api.github.com/users/maphi/gists{/gist_id}","starred_url":"https://api.github.com/users/maphi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maphi/subscriptions","organizations_url":"https://api.github.com/users/maphi/orgs","repos_url":"https://api.github.com/users/maphi/repos","events_url":"https://api.github.com/users/maphi/events{/privacy}","received_events_url":"https://api.github.com/users/maphi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-10-21T19:30:25Z","updated_at":"2018-10-22T07:44:50Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/functional-streams-for-scala/fs2/pulls/1296","html_url":"https://github.com/functional-streams-for-scala/fs2/pull/1296","diff_url":"https://github.com/functional-streams-for-scala/fs2/pull/1296.diff","patch_url":"https://github.com/functional-streams-for-scala/fs2/pull/1296.patch"},"body":"Improves dequeue1 performance on Queue. Also fixed some typos"},"comment":{"url":"https://api.github.com/repos/functional-streams-for-scala/fs2/issues/comments/431763051","html_url":"https://github.com/functional-streams-for-scala/fs2/pull/1296#issuecomment-431763051","issue_url":"https://api.github.com/repos/functional-streams-for-scala/fs2/issues/1296","id":431763051,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMTc2MzA1MQ==","user":{"login":"maphi","id":9135719,"node_id":"MDQ6VXNlcjkxMzU3MTk=","avatar_url":"https://avatars3.githubusercontent.com/u/9135719?v=4","gravatar_id":"","url":"https://api.github.com/users/maphi","html_url":"https://github.com/maphi","followers_url":"https://api.github.com/users/maphi/followers","following_url":"https://api.github.com/users/maphi/following{/other_user}","gists_url":"https://api.github.com/users/maphi/gists{/gist_id}","starred_url":"https://api.github.com/users/maphi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maphi/subscriptions","organizations_url":"https://api.github.com/users/maphi/orgs","repos_url":"https://api.github.com/users/maphi/repos","events_url":"https://api.github.com/users/maphi/events{/privacy}","received_events_url":"https://api.github.com/users/maphi/received_events","type":"User","site_admin":false},"created_at":"2018-10-22T07:44:50Z","updated_at":"2018-10-22T07:44:50Z","author_association":"NONE","body":"Sample Code to test performance:\r\n```\r\nimport java.util.concurrent.TimeUnit\r\n\r\nimport cats.effect._\r\nimport cats.implicits._\r\nimport fs2.concurrent.Queue\r\n\r\nobject Dequeue1PerfApp extends IOApp {\r\n\r\n  val fillQueueCount = 100000\r\n\r\n  override def run(args: List[String]): IO[ExitCode] =\r\n    for {\r\n      queue       <- Queue.unbounded[IO, Unit]\r\n      _           <- List.range(0, fillQueueCount).traverse(_ => queue.offer1(()))\r\n      dequeue1K   <- List.range(0, fillQueueCount / 1000).traverse{_ =>\r\n                      for {\r\n                        start <- timer.clock.monotonic(TimeUnit.NANOSECONDS)\r\n                        _     <- List.range(0, 1000).traverse(_ => queue.dequeue1)\r\n                        end   <- timer.clock.monotonic(TimeUnit.NANOSECONDS)\r\n                      } yield end - start\r\n                    }\r\n      _           <- IO(dequeue1K.foreach(println))\r\n    } yield ExitCode.Success\r\n\r\n}\r\n```\r\n\r\nFor me without this fix it takes ~90 seconds and with only 5 seconds ."}}
{"actor":{"display_login":"maphi"}}