{"action":"created","issue":{"url":"https://api.github.com/repos/getify/deePool/issues/4","repository_url":"https://api.github.com/repos/getify/deePool","labels_url":"https://api.github.com/repos/getify/deePool/issues/4/labels{/name}","comments_url":"https://api.github.com/repos/getify/deePool/issues/4/comments","events_url":"https://api.github.com/repos/getify/deePool/issues/4/events","html_url":"https://github.com/getify/deePool/pull/4","id":198088542,"number":4,"title":"Algorithmic improvements","user":{"login":"joekarl","id":150038,"avatar_url":"https://avatars.githubusercontent.com/u/150038?v=3","gravatar_id":"","url":"https://api.github.com/users/joekarl","html_url":"https://github.com/joekarl","followers_url":"https://api.github.com/users/joekarl/followers","following_url":"https://api.github.com/users/joekarl/following{/other_user}","gists_url":"https://api.github.com/users/joekarl/gists{/gist_id}","starred_url":"https://api.github.com/users/joekarl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joekarl/subscriptions","organizations_url":"https://api.github.com/users/joekarl/orgs","repos_url":"https://api.github.com/users/joekarl/repos","events_url":"https://api.github.com/users/joekarl/events{/privacy}","received_events_url":"https://api.github.com/users/joekarl/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":15,"created_at":"2016-12-30T00:30:21Z","updated_at":"2017-01-19T08:10:07Z","closed_at":"2017-01-19T08:10:07Z","pull_request":{"url":"https://api.github.com/repos/getify/deePool/pulls/4","html_url":"https://github.com/getify/deePool/pull/4","diff_url":"https://github.com/getify/deePool/pull/4.diff","patch_url":"https://github.com/getify/deePool/pull/4.patch"},"body":"Just some things to think about (and some poorly written example code)\r\n\r\nThe original implementation of deePool methods have an O(n) time\r\ncomplexity (in particular use/recycle).\r\nThis change makes those methods O(1) and vastly simplifies the code\r\nIt makes the concession of sacrificing ordering while growing the pool\r\nand recycling objects (this is OK as the deePool didn't specify that\r\nthere was supposed to be any ordering semantics).\r\n\r\nTests are still busted (due to them relying on un-specified ordering\r\nsemantics) but functionally all works.\r\nAlso forgive the tabs/spaces mismatch. \r\n\r\nHere's the difference in perf numbers:\r\nOriginal implementation:\r\n```\r\ndeePool Performance Benchmarks\r\ndeePool.create()... complete: 6,644,319 ops/sec (391771 samples)\r\nuse() + recycle(): small pool (10)... complete: 9,704,383 ops/sec (533343 samples)\r\nuse() + recycle(): medium pool (10,000)... complete: 14,060 ops/sec (726 samples)\r\nuse() + recycle(): large pool (1,000,000)... complete: 132 ops/sec (7 samples)\r\nuse(): growing pool... complete: 2,662,634 ops/sec (397408 samples)\r\ngrow(): small increments... complete: 4,825 ops/sec (5000 samples)\r\ngrow(): medium increments... complete: 1,395 ops/sec (150 samples)\r\ngrow(): large increments... complete: 92 ops/sec (90 samples)\r\ngrow(): exponential (doubling)... complete: 49 ops/sec (19 samples)\r\nuse() + recycle(): interleaved... complete: 1,851,973 ops/sec (203786 samples)\r\nuse() + recycle(): multiple of each... <doesn't finish in reasonable time...>\r\n```\r\n\r\n0(1) implementation:\r\n```\r\ndeePool Performance Benchmarks\r\ndeePool.create()... complete: 7,929,288 ops/sec (414483 samples)\r\nuse() + recycle(): small pool... complete: 44,645,133 ops/sec (2362781 samples)\r\nuse() + recycle(): medium pool... complete: 41,821,068 ops/sec (2356688 samples)\r\nuse() + recycle(): large pool... complete: 41,899,579 ops/sec (2416356 samples)\r\nuse(): growing pool... complete: 2,555,250 ops/sec (238327 samples)\r\ngrow(): small increments... complete: 708,790 ops/sec (162082 samples)\r\ngrow(): medium increments... complete: 7,729 ops/sec (2504 samples)\r\ngrow(): large increments... complete: 367 ops/sec (90 samples)\r\ngrow(): exponential (doubling)... complete: 65 ops/sec (19 samples)\r\nuse() + recycle(): interleaved... complete: 2,192,863 ops/sec (245557 samples)\r\nuse() + recycle(): multiple of each... complete: 35,301 ops/sec (5000 samples)\r\n```\r\n\r\nNote the perf decrease on `use() + recycle()` as the pool gets larger in the original implementation.\r\nThe ops/sec drop is almost exactly linear with respect the increase in pool size (indicating O(n))"},"comment":{"url":"https://api.github.com/repos/getify/deePool/issues/comments/273707653","html_url":"https://github.com/getify/deePool/pull/4#issuecomment-273707653","issue_url":"https://api.github.com/repos/getify/deePool/issues/4","id":273707653,"user":{"login":"getify","id":150330,"avatar_url":"https://avatars.githubusercontent.com/u/150330?v=3","gravatar_id":"","url":"https://api.github.com/users/getify","html_url":"https://github.com/getify","followers_url":"https://api.github.com/users/getify/followers","following_url":"https://api.github.com/users/getify/following{/other_user}","gists_url":"https://api.github.com/users/getify/gists{/gist_id}","starred_url":"https://api.github.com/users/getify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/getify/subscriptions","organizations_url":"https://api.github.com/users/getify/orgs","repos_url":"https://api.github.com/users/getify/repos","events_url":"https://api.github.com/users/getify/events{/privacy}","received_events_url":"https://api.github.com/users/getify/received_events","type":"User","site_admin":false},"created_at":"2017-01-19T08:10:07Z","updated_at":"2017-01-19T08:10:07Z","body":"inspired by your simpler algorithm ideas, i just rewrote the code. thoughts welcome. :)"}}
{"actor":{"display_login":"getify"}}