Re: Performance question

Posted by Christopher Targett-Adams on
URL: http://quantlib.414.s1.nabble.com/Performance-question-tp8763p8771.html

Apolgies, I meant 4s vs 0.04s
 
Chris
 

From: [hidden email]
To: [hidden email]
Subject: Performance question
Date: Sun, 31 Jul 2011 22:05:08 +0100


Dear Quantlib users/developers,
 
I have a question related to the performance of some of the QL classes. I am currently looking at developing a system using the QL framework and have been doing some feasibility studies using some of the yield curve and interpolation classes. I set the following test up:
 
1) I performed 130000 linear interpolations using the InterpolatedCurve<Linear> class. Basically, I define an x and y std::vector<double> which are 13 elements long and then I have a for loop which performs 130000 iterations and calls the relevant interpolation method on each iteration. It's very simple.
2) I then compare this to a classic procedural implementation of linear interpolation, ie a function that just takes in two double[13] arrays, does a bisection search and then does a linear interpolation between the located grid points. Again, very simple stuff.
 
I am by no means trying to claim I'm comparing like with like and I expect QL to be a bit slower than procedural c++, however, the QL interpolation is very slow: the 130000 interpolations takes about 4 seconds compared to 0.4 seconds for the procedural implementation.That's 100 times slower! What's more perplexing is even when I take out the error checking and hack the locate method so that it just returns 0 (thus elimating any time spent in the grid seach) it still takes the same order of magnitude to run. There's a lot going on in the code with smart pointer use, std::vectors, iterators, templates, inheritance, polymorphism and my under-the-bonnet knowledge of c++ isn't good enough to allow me to understand why it's taking so long.
 
Does anyone know what the cause of the poor performance is?
 
Chris

------------------------------------------------------------------------------
Got Input?   Slashdot Needs You.
Take our quick survey online.  Come on, we don't ask for help often.
Plus, you'll get a chance to win $100 to spend on ThinkGeek.
http://p.sf.net/sfu/slashdot-survey
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users