forum.alglib.net
http://forum.alglib.net/

Performance of LMA in C# vs C++?
http://forum.alglib.net/viewtopic.php?f=2&t=412
Page 1 of 1

Author:  panzram [ Tue Aug 16, 2011 7:35 am ]
Post subject:  Performance of LMA in C# vs C++?

Hi,

First off, thanks for a superb library. I use it daily in my work in finance. Recently I've experienced some performance issues when I try to use MinCreateV to bootstrap a curve in C#. I seem to remember reading somewhere that the performance of the C# was not the same as the C++. I need to decide if I should migrate my code to C++ or have another look at my C# code.

Regards

Author:  Sergey.Bochkanov [ Tue Aug 16, 2011 7:50 pm ]
Post subject:  Re: Performance of LMA in C# vs C++?

Can you post your problem details? In particular, it can be useful to know:
* number of points
* number of parameters being fitted
* algorithmic complexity of the function used to fit points (hard to calculate, moderate complexity, easy one)

You may see 2-5 fold performance increase when moving from C# to C++, but there is some dependency on the problem details. Some configurations will give you moderate performance gain, while others will give higher one.

Author:  panzram [ Mon Aug 22, 2011 7:20 am ]
Post subject:  Re: Performance of LMA in C# vs C++?

Hi,

Thanks for your reply (and a great lib). If it is 2-5 times faster in c++, then I think I must migrate.

The performance issue that I've noticed is basically the same regardless of the number of nodes, in relative terms. When I try to tweak the parameters, ie the precision or the size of the steps etc, I can affect the performance plenty. However, when I move from a test environment to the real world (with frequent updates and recalculations) it is obviously not enough.

In reply to your questions, I'll give you an example of a typical problem:

We need to make sure that a curve (given a spline or other interpolation method) reprices a group of swaps (2-10 years, 15, 20 and 30 years for example), with annual coupon payments vs 3 month payments. That is, we have 30 + 30 * 4 = 150 points that need to reprice 12 swaps. I'm not sure if this is particularily complicated. When I tweak this problem, I can get it down to under a second. We do this in other systems where it's done lightning fast.

I will try to optimize the way I'm approaching the problem and see if there is something that I've missed, but I doubt it.

Regards.

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/