|
From: Luigi B. <lui...@gm...> - 2020-06-09 16:01:48
|
Switching off notifyObservers() would prevent the instruments from recalculating, so I guess that would affect the simulation. How are you setting up the simulation? Do you create the instruments and then relink the handle for each scenario? Or do you create new instruments for different scenarios? Luigi On Fri, Jun 5, 2020 at 6:12 PM Amine Ifri <ami...@gm...> wrote: > Hi Luigi, all, > > I have been working on leveraging QL to create a small multi-step Monte > Carlo framework which simulates market data at each future time step and > calls discounting swap engine on vanilla swaps. A full Monte Carlo run > with 1000 scenarios and 350 time points takes about 4min to run. I run my > application through the time profiler and noticed that quite a bit of time > is spent in the scenario loop where I continuously relink the yield curve > handle to the appropriately simulated curve. > > Are there any ways/tips one could provide on where I could look for extra > time savings? I found out that by using the discount(Time ) instead of the > discount(Date&) variant of the method for example, one can save on the year > fraction calculation, which improves the time a bit. I also de-activated a > check on MaxTime() in TermStructure::checkRange() which is continuously > called at each scenario. > > In particular, I would like to know if I could switch off the notify > observers() in the Handle::linkTo() method without affecting the inner > workings, as I am not interested at this stage in using the > observable/observer pattern. > > Thanks and Regards, > Amine |