{"action":"created","issue":{"url":"https://api.github.com/repos/twitter/algebird/issues/591","repository_url":"https://api.github.com/repos/twitter/algebird","labels_url":"https://api.github.com/repos/twitter/algebird/issues/591/labels{/name}","comments_url":"https://api.github.com/repos/twitter/algebird/issues/591/comments","events_url":"https://api.github.com/repos/twitter/algebird/issues/591/events","html_url":"https://github.com/twitter/algebird/pull/591","id":192946301,"number":591,"title":"optimize Generated{Abstract,Product}Algebra with benchmarking","user":{"login":"sritchie","id":69635,"avatar_url":"https://avatars.githubusercontent.com/u/69635?v=3","gravatar_id":"","url":"https://api.github.com/users/sritchie","html_url":"https://github.com/sritchie","followers_url":"https://api.github.com/users/sritchie/followers","following_url":"https://api.github.com/users/sritchie/following{/other_user}","gists_url":"https://api.github.com/users/sritchie/gists{/gist_id}","starred_url":"https://api.github.com/users/sritchie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sritchie/subscriptions","organizations_url":"https://api.github.com/users/sritchie/orgs","repos_url":"https://api.github.com/users/sritchie/repos","events_url":"https://api.github.com/users/sritchie/events{/privacy}","received_events_url":"https://api.github.com/users/sritchie/received_events","type":"User","site_admin":false},"labels":[{"id":10744079,"url":"https://api.github.com/repos/twitter/algebird/labels/enhancement","name":"enhancement","color":"84b6eb","default":true},{"id":468040854,"url":"https://api.github.com/repos/twitter/algebird/labels/performance","name":"performance","color":"fbca04","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-12-01T19:57:29Z","updated_at":"2016-12-01T23:26:01Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/twitter/algebird/pulls/591","html_url":"https://github.com/twitter/algebird/pull/591","diff_url":"https://github.com/twitter/algebird/pull/591.diff","patch_url":"https://github.com/twitter/algebird/pull/591.patch"},"body":"This PR\r\n\r\n- Adds a benchmark for `Tuple4` (seemed like a nice one to pick :)\r\n- corrects some bad performance in the generated `sumOption` implementations that this benchmark uncovered.\r\n\r\nRun the benchmark with:\r\n\r\n```\r\nsbt algebird-benchmark/jmh:run -t1 -f 1 -wi 5 -i 15 .*Tuple4Benchmark.*\r\n```\r\n\r\n### Benchmark Results\r\n\r\nBefore the changes:\r\n```\r\n[info] Benchmark                             (numElements)   Mode  Cnt     Score     Error  Units\r\n[info] Tuple4Benchmark.timeProductPlus               10000  thrpt   15  1870.581 ± 149.159  ops/s\r\n[info] Tuple4Benchmark.timeProductSumOption          10000  thrpt   15   492.128 ±  29.016  ops/s\r\n[info] Tuple4Benchmark.timeTuplePlus                 10000  thrpt   15  3911.323 ± 106.611  ops/s\r\n[info] Tuple4Benchmark.timeTupleSumOption            10000  thrpt   15  2682.713 ±  39.312  ops/s\r\n```\r\n\r\nAfter the changes:\r\n```\r\n[info] Benchmark                             (numElements)   Mode  Cnt     Score     Error  Units\r\n[info] Tuple4Benchmark.timeProductPlus               10000  thrpt   15  1934.965 ±  50.165  ops/s\r\n[info] Tuple4Benchmark.timeProductSumOption          10000  thrpt   15  2896.808 ±  71.128  ops/s\r\n[info] Tuple4Benchmark.timeTuplePlus                 10000  thrpt   15  3893.420 ± 139.511  ops/s\r\n[info] Tuple4Benchmark.timeTupleSumOption            10000  thrpt   15  4073.248 ±  60.992  ops/s\r\n[success] Total time: 88 s, completed Dec 1, 2016 12:48:43 PM\r\n```\r\n\r\nso ~6x improvement for the ProductN semigroups, 1.5x improvement for the tupleN semigroups. AND, more importantly, they're all more efficient than just using `plus`.\r\n\r\nNote that benchmarks only adds longs, so it measures the improvement of `sumOption` on tuples when the tuple elements don't have an efficient `sumOption` implementation. When they do, these `sumOption` implementations will be that much faster."},"comment":{"url":"https://api.github.com/repos/twitter/algebird/issues/comments/264327363","html_url":"https://github.com/twitter/algebird/pull/591#issuecomment-264327363","issue_url":"https://api.github.com/repos/twitter/algebird/issues/591","id":264327363,"user":{"login":"isnotinvain","id":372969,"avatar_url":"https://avatars.githubusercontent.com/u/372969?v=3","gravatar_id":"","url":"https://api.github.com/users/isnotinvain","html_url":"https://github.com/isnotinvain","followers_url":"https://api.github.com/users/isnotinvain/followers","following_url":"https://api.github.com/users/isnotinvain/following{/other_user}","gists_url":"https://api.github.com/users/isnotinvain/gists{/gist_id}","starred_url":"https://api.github.com/users/isnotinvain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/isnotinvain/subscriptions","organizations_url":"https://api.github.com/users/isnotinvain/orgs","repos_url":"https://api.github.com/users/isnotinvain/repos","events_url":"https://api.github.com/users/isnotinvain/events{/privacy}","received_events_url":"https://api.github.com/users/isnotinvain/received_events","type":"User","site_admin":false},"created_at":"2016-12-01T23:26:01Z","updated_at":"2016-12-01T23:26:01Z","body":"LGTM\r\n\r\nAny idea why ignoring `size` didn't trigger a test failure? Is that just a size hint for performance?\r\n\r\nDoes this now always use sumOption, even when plus would normally be called? I wonder if any `plus(x,y)` implementations are more efficient than `sumOption(Seq(x,y))` in the case of only adding 2 items together? (eg, map monoid's sumOption creating a whole mutable hash map in sumOption)"}}
{"actor":{"display_login":"isnotinvain"}}