QuantLib
QuantLib copied to clipboard
Problematic inheritance in DefaultLossModel
The DefaultLossModel class inherits non-virtually from Observable, which is flagged as a problem by LGTM (see here) because a few classes inherit from DefaultLossModel and from another class that inherits virtually from Observable.
This can be fixed by having DefaultLossModel use virtual inheritance from Observable; however, doing so adds half an hour to the running time of the tests, mostly because of the CDO tests. The tests pass in both cases.
The reason is not obvious, and should be investigated. It might be that the longer running time is due to more notifications going around and triggering recalculations; in that case, we should assess if the additional notifications are required (and possibly if DefaultLossModel should inherit from Observable at all, given that it doesn't call notifyObservers in its implementation).
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I stumbled upon this again today after having forgotten I opened this issue already. 😄
With the additional (and possibly correct?) virtual inheritance, each of the 5 testHW cases in CdoTest go from 20 seconds to 400/500.
@japari, do you have any insight into this?
Hello, I will look into it; hopefully in a reasonable time so it does go stale again.....
Take your time. I labeled it so it won't go stale anymore. 😄