{"action":"created","issue":{"url":"https://api.github.com/repos/lballabio/quantlib/issues/192","labels_url":"https://api.github.com/repos/lballabio/quantlib/issues/192/labels{/name}","comments_url":"https://api.github.com/repos/lballabio/quantlib/issues/192/comments","events_url":"https://api.github.com/repos/lballabio/quantlib/issues/192/events","html_url":"https://github.com/lballabio/quantlib/pull/192","id":56424138,"number":192,"title":"Optimize `DiscountingSwapEngine`","user":{"login":"pcaspers","id":2605997,"avatar_url":"https://avatars.githubusercontent.com/u/2605997?v=3","gravatar_id":"","url":"https://api.github.com/users/pcaspers","html_url":"https://github.com/pcaspers","followers_url":"https://api.github.com/users/pcaspers/followers","following_url":"https://api.github.com/users/pcaspers/following{/other_user}","gists_url":"https://api.github.com/users/pcaspers/gists{/gist_id}","starred_url":"https://api.github.com/users/pcaspers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pcaspers/subscriptions","organizations_url":"https://api.github.com/users/pcaspers/orgs","repos_url":"https://api.github.com/users/pcaspers/repos","events_url":"https://api.github.com/users/pcaspers/events{/privacy}","received_events_url":"https://api.github.com/users/pcaspers/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-02-03T19:26:59Z","updated_at":"2015-02-04T14:29:21Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/lballabio/quantlib/pulls/192","html_url":"https://github.com/lballabio/quantlib/pull/192","diff_url":"https://github.com/lballabio/quantlib/pull/192.diff","patch_url":"https://github.com/lballabio/quantlib/pull/192.patch"},"body":"the npvbps change seems to give a speedup of 1.2x - 1.3x, the caching of the accrual period another 1.1x if the same swap is priced several times."},"comment":{"url":"https://api.github.com/repos/lballabio/quantlib/issues/comments/72862732","html_url":"https://github.com/lballabio/quantlib/pull/192#issuecomment-72862732","issue_url":"https://api.github.com/repos/lballabio/quantlib/issues/192","id":72862732,"user":{"login":"fametrano","id":3296421,"avatar_url":"https://avatars.githubusercontent.com/u/3296421?v=3","gravatar_id":"","url":"https://api.github.com/users/fametrano","html_url":"https://github.com/fametrano","followers_url":"https://api.github.com/users/fametrano/followers","following_url":"https://api.github.com/users/fametrano/following{/other_user}","gists_url":"https://api.github.com/users/fametrano/gists{/gist_id}","starred_url":"https://api.github.com/users/fametrano/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fametrano/subscriptions","organizations_url":"https://api.github.com/users/fametrano/orgs","repos_url":"https://api.github.com/users/fametrano/repos","events_url":"https://api.github.com/users/fametrano/events{/privacy}","received_events_url":"https://api.github.com/users/fametrano/received_events","type":"User","site_admin":false},"created_at":"2015-02-04T14:29:21Z","updated_at":"2015-02-04T14:29:21Z","body":"1) accrualPeriod_ in Coupon could be initialized at construction time, avoiding to declare it mutable\r\n2) boost::shared_ptr<Coupon> cp = boost::dynamic_pointer_cast<Coupon>(leg[i]); should be inside the if avoiding the pointer cast if the cashflow has occurred.\r\n\r\nI had other optimizations about occured cashflows that I might have forgot to share: I will shortly "}}