{"action":"created","issue":{"url":"https://api.github.com/repos/stan-dev/math/issues/825","repository_url":"https://api.github.com/repos/stan-dev/math","labels_url":"https://api.github.com/repos/stan-dev/math/issues/825/labels{/name}","comments_url":"https://api.github.com/repos/stan-dev/math/issues/825/comments","events_url":"https://api.github.com/repos/stan-dev/math/issues/825/events","html_url":"https://github.com/stan-dev/math/pull/825","id":312320141,"number":825,"title":"fix performance regression bug, fixes #824","user":{"login":"wds15","id":12070126,"avatar_url":"https://avatars0.githubusercontent.com/u/12070126?v=4","gravatar_id":"","url":"https://api.github.com/users/wds15","html_url":"https://github.com/wds15","followers_url":"https://api.github.com/users/wds15/followers","following_url":"https://api.github.com/users/wds15/following{/other_user}","gists_url":"https://api.github.com/users/wds15/gists{/gist_id}","starred_url":"https://api.github.com/users/wds15/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wds15/subscriptions","organizations_url":"https://api.github.com/users/wds15/orgs","repos_url":"https://api.github.com/users/wds15/repos","events_url":"https://api.github.com/users/wds15/events{/privacy}","received_events_url":"https://api.github.com/users/wds15/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2018-04-08T16:41:26Z","updated_at":"2018-04-09T20:15:29Z","closed_at":"2018-04-09T20:15:29Z","author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/stan-dev/math/pulls/825","html_url":"https://github.com/stan-dev/math/pull/825","diff_url":"https://github.com/stan-dev/math/pull/825.diff","patch_url":"https://github.com/stan-dev/math/pull/825.patch"},"body":"#### Submission Checklist\r\n\r\n- [ ] Run unit tests: `./runTests.py test/unit`\r\n- [ ] Run cpplint: `make cpplint`\r\n- [X] Declare copyright holder and open-source license: see below\r\n\r\n#### Summary:\r\nAdresses performance regression bug introduced with threaded AD stack change.\r\n\r\nIt turns out that using a `static` variables declared as member of a `static` function is causing problems for the compiler to optimize. This PR changes this such that directly a global instance of `ChainableStack` is declared. Whenever threads are to be used, the `thread_local` keyword is used.\r\n\r\nThis change did solve the performance regression problems:\r\n\r\n- performance prior to the threaded AD pull (cmdstan hash `8f218b6c0584af995ed7e48faa8408d03cb040ee`:\r\n```\r\nstat_comp_benchmarks/benchmarks/arK/arK.stan,2.10290490389\r\n```\r\n\r\n- performance after this change:\r\n```\r\nstat_comp_benchmarks/benchmarks/arK/arK.stan,1.90999811888\r\n```\r\n\r\n- for reference, performance with the threaded AD changes which caused the slow down:\r\n```\r\nstat_comp_benchmarks/benchmarks/arK/arK.stan,2.34019263983\r\n```\r\n\r\nall of the above are without threading enabled.\r\n\r\n#### Intended Effect:\r\nrecover speed.\r\n\r\n#### How to Verify:\r\nRun the performance regression framework. Please use as reference for the cmdstan hash `8f218b6c0584af995ed7e48faa8408d03cb040ee`.\r\n\r\n#### Side Effects:\r\nLooks like that things get faster.\r\n\r\n#### Documentation:\r\n\r\n#### Copyright and Licensing\r\n\r\nPlease list the copyright holder for the work you are submitting (this will be you or your assignee, such as a university or company): Sebastian Weber\r\n\r\nBy submitting this pull request, the copyright holder is agreeing to license the submitted work under the following licenses:\r\n- Code: BSD 3-clause (https://opensource.org/licenses/BSD-3-Clause)\r\n- Documentation: CC-BY 4.0 (https://creativecommons.org/licenses/by/4.0/)"},"comment":{"url":"https://api.github.com/repos/stan-dev/math/issues/comments/379879852","html_url":"https://github.com/stan-dev/math/pull/825#issuecomment-379879852","issue_url":"https://api.github.com/repos/stan-dev/math/issues/825","id":379879852,"user":{"login":"wds15","id":12070126,"avatar_url":"https://avatars0.githubusercontent.com/u/12070126?v=4","gravatar_id":"","url":"https://api.github.com/users/wds15","html_url":"https://github.com/wds15","followers_url":"https://api.github.com/users/wds15/followers","following_url":"https://api.github.com/users/wds15/following{/other_user}","gists_url":"https://api.github.com/users/wds15/gists{/gist_id}","starred_url":"https://api.github.com/users/wds15/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wds15/subscriptions","organizations_url":"https://api.github.com/users/wds15/orgs","repos_url":"https://api.github.com/users/wds15/repos","events_url":"https://api.github.com/users/wds15/events{/privacy}","received_events_url":"https://api.github.com/users/wds15/received_events","type":"User","site_admin":false},"created_at":"2018-04-09T20:15:29Z","updated_at":"2018-04-09T20:15:29Z","author_association":"CONTRIBUTOR","body":"compilers are really weird. I think I found a solution which I put into another pull."}}
{"actor":{"display_login":"wds15"}}