Posted by
Slava Mazur-2 on
URL: http://quantlib.414.s1.nabble.com/Performance-question-tp8763p8770.html
Hi Nando,
> for me it's hard to believe that bisection might be an efficiency bottleneck in a real-world financial usage of linear interpolation...
This is primarily because QuantLib is not meant to be used on intra-day time scales.
In my quite "real-world financial usage" I tried to use QuantLib for estimation of an intra-day volatility.
Originally I stored an intra-day volatility pattern in a LinearInterpolation object.
Soon, however, it's become apparent that querying it say every second for the whole universe of US stocks presents a real performance bottleneck for both real time and back-testing apps.
> It could be improved (e.g. caching the bracketing result as guess for the next one)
One of the pros of the current design is that the object is stateless. Introducing a state might present unnecessary complexity to deal with in multi-threading environment.
What I would suggest is to keep the stateless paradigm intact and introduce a new, an iterator-like object (e.g. LinearInterpolationItertor) on top of it.
Unfortunately at the moment I don't have time to code it.
Thanks,
Slava Mazur
-----Original Message-----
From:
[hidden email] [mailto:
[hidden email]] On Behalf Of Ferdinando Ametrano
Sent: Thursday, August 04, 2011 5:30 AM
To: Slava Mazur
Cc:
[hidden email]
Subject: Re: [Quantlib-users] Performance question
Hi all
On Tue, Aug 2, 2011 at 10:59 PM, Slava Mazur <
[hidden email]> wrote:
> Perhaps this is because the interpolation implementation classes
> perform binary search to locate the position of every x argument. If
> you call it thousands of times there will be thousands binary searches.
for me it's hard to believe that bisection might be an efficiency bottleneck in a real-world financial usage of linear interpolation...
It could be improved (e.g. caching the bracketing result as guess for the next one)
> Also, I'd like to take this opportunity to point out that there is a
> potential danger in the design of interpolation objects - they take
> iterators as input during construction. This is an additional argument
> in favor of use of interpolation object as a temporal one.
you're right: interpolations are meant to be contained inside some other object which guarantees persistence of the X and Y vectors to be interpolated. An example of such a container is QuantLibAddin::Interpolation, which also implement the (lazy) observability of the QuantLib::Quote vector used as Y vector.
I personally advocate moving QuantLibAddin::Interpolation in QuantLib, but if I'm not wrong Luigi is skeptical
ciao -- Nando
------------------------------------------------------------------------------
BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts.
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos & much more. Register early & save!
http://p.sf.net/sfu/rim-blackberry-1_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users