{"action":"created","issue":{"url":"https://api.github.com/repos/scala/scala/issues/4333","labels_url":"https://api.github.com/repos/scala/scala/issues/4333/labels{/name}","comments_url":"https://api.github.com/repos/scala/scala/issues/4333/comments","events_url":"https://api.github.com/repos/scala/scala/issues/4333/events","html_url":"https://github.com/scala/scala/pull/4333","id":57681236,"number":4333,"title":"Performance optimization - Iterator","user":{"login":"Ichoran","id":2298644,"avatar_url":"https://avatars.githubusercontent.com/u/2298644?v=3","gravatar_id":"","url":"https://api.github.com/users/Ichoran","html_url":"https://github.com/Ichoran","followers_url":"https://api.github.com/users/Ichoran/followers","following_url":"https://api.github.com/users/Ichoran/following{/other_user}","gists_url":"https://api.github.com/users/Ichoran/gists{/gist_id}","starred_url":"https://api.github.com/users/Ichoran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ichoran/subscriptions","organizations_url":"https://api.github.com/users/Ichoran/orgs","repos_url":"https://api.github.com/users/Ichoran/repos","events_url":"https://api.github.com/users/Ichoran/events{/privacy}","received_events_url":"https://api.github.com/users/Ichoran/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"SethTisue","id":161079,"avatar_url":"https://avatars.githubusercontent.com/u/161079?v=3","gravatar_id":"","url":"https://api.github.com/users/SethTisue","html_url":"https://github.com/SethTisue","followers_url":"https://api.github.com/users/SethTisue/followers","following_url":"https://api.github.com/users/SethTisue/following{/other_user}","gists_url":"https://api.github.com/users/SethTisue/gists{/gist_id}","starred_url":"https://api.github.com/users/SethTisue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SethTisue/subscriptions","organizations_url":"https://api.github.com/users/SethTisue/orgs","repos_url":"https://api.github.com/users/SethTisue/repos","events_url":"https://api.github.com/users/SethTisue/events{/privacy}","received_events_url":"https://api.github.com/users/SethTisue/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/scala/scala/milestones/49","html_url":"https://github.com/scala/scala/milestones/2.11.8","labels_url":"https://api.github.com/repos/scala/scala/milestones/49/labels","id":1169165,"number":49,"title":"2.11.8","description":"Merge to 2.11.x.\r\n","creator":{"login":"SethTisue","id":161079,"avatar_url":"https://avatars.githubusercontent.com/u/161079?v=3","gravatar_id":"","url":"https://api.github.com/users/SethTisue","html_url":"https://github.com/SethTisue","followers_url":"https://api.github.com/users/SethTisue/followers","following_url":"https://api.github.com/users/SethTisue/following{/other_user}","gists_url":"https://api.github.com/users/SethTisue/gists{/gist_id}","starred_url":"https://api.github.com/users/SethTisue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SethTisue/subscriptions","organizations_url":"https://api.github.com/users/SethTisue/orgs","repos_url":"https://api.github.com/users/SethTisue/repos","events_url":"https://api.github.com/users/SethTisue/events{/privacy}","received_events_url":"https://api.github.com/users/SethTisue/received_events","type":"User","site_admin":false},"open_issues":15,"closed_issues":59,"state":"open","created_at":"2015-06-17T19:08:28Z","updated_at":"2015-08-06T23:04:34Z","due_on":"2015-09-21T07:00:00Z","closed_at":null},"comments":7,"created_at":"2015-02-14T04:50:23Z","updated_at":"2015-08-07T00:53:27Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/scala/scala/pulls/4333","html_url":"https://github.com/scala/scala/pull/4333","diff_url":"https://github.com/scala/scala/pull/4333.diff","patch_url":"https://github.com/scala/scala/pull/4333.patch"},"body":"Rewrite of `span` to avoid `.buffered` and to only use `mutable.Queue` when absolutely necessary.  Avoid `buffered` in `dropWhile` and `collect`.\r\n\r\nTidied up other methods by using local `return`.  This doesn't always improve performance, but the code is more compact and (I'd argue) easier to follow, and the bytecode is reduced which in appropriate contexts will help with inlining.\r\n\r\nSummary of improvements (all timings JDK 1.8.0_25 Linux):\r\n\r\n```\r\nmethod        reason\r\n===========   ===============================================================\r\ncommit 1\r\n-----------   ---------------------------------------------------------------\r\nflatMap       34 bytes instead of 62 in hasNext \r\nfind          41 bytes instead of 53\r\nindexWhere    1.5x faster on small collections (some contexts)\r\nindexOf       89 bytes instead of 110 \r\n\r\ncommit 2\r\n-----------   ---------------------------------------------------------------\r\ncollect       2.3x faster on small collections, 1.5x on large\r\n\r\nspan          1.6-1.7x faster on small collections\r\n              0.85x-1.8x slower/faster on large collections\r\n                depending on how much must be cached (0.85x all, 1.8x none)\r\n\r\ndropWhile     1.2x faster on small collections, half the garbage\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/scala/scala/issues/comments/128551480","html_url":"https://github.com/scala/scala/pull/4333#issuecomment-128551480","issue_url":"https://api.github.com/repos/scala/scala/issues/4333","id":128551480,"user":{"login":"SethTisue","id":161079,"avatar_url":"https://avatars.githubusercontent.com/u/161079?v=3","gravatar_id":"","url":"https://api.github.com/users/SethTisue","html_url":"https://github.com/SethTisue","followers_url":"https://api.github.com/users/SethTisue/followers","following_url":"https://api.github.com/users/SethTisue/following{/other_user}","gists_url":"https://api.github.com/users/SethTisue/gists{/gist_id}","starred_url":"https://api.github.com/users/SethTisue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SethTisue/subscriptions","organizations_url":"https://api.github.com/users/SethTisue/orgs","repos_url":"https://api.github.com/users/SethTisue/repos","events_url":"https://api.github.com/users/SethTisue/events{/privacy}","received_events_url":"https://api.github.com/users/SethTisue/received_events","type":"User","site_admin":false},"created_at":"2015-08-07T00:53:27Z","updated_at":"2015-08-07T00:53:27Z","body":"@Ichoran ping"}}